无法在弹性搜索中更新映射
Unable to update mapping in elastic search
我有一个 shell 脚本,用于在弹性搜索中创建到我的 document types
之一的映射。
我的 elasticsearch 索引是 bits
,我的文档类型是 nts
,我正在尝试为 JSON 类型文档中的 3 个 JSON 键分配类型 long
=14=]
即 NT
、XT
和 YT
。
#!/bin/bash
curl -XPUT 'http://localhost:9200/bits/nts/_mapping' -d '
{
"events" : {
"dynamic" : "strict",
"properties" : {
"NT" : {
type : "long"
},
"XT" : {
type : "long"
},
"YT" : {
type : "long"
}
}
},
}'
如果我运行上面的bash脚本,我得到以下错误。
{"error":"ElasticsearchParseException[Failed to parse content to map]; nested: JsonParseException[Unexpected character ('}' (code 125)): was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name\n at [Source: org.elasticsearch.common.compress.lzf.LZFCompressedStreamInput@6d7702cc; line: 17, column: 6]]; ","status":400}
去掉最后一个逗号,把代码改成这样
curl -XPUT 'http://localhost:9200/bits/nts/_mapping' -d '
{
"events" : {
"dynamic" : "strict",
"properties" : {
"NT" : {
type : "long"
},
"XT" : {
type : "long"
},
"YT" : {
type : "long"
}
}
}
}'
我有一个 shell 脚本,用于在弹性搜索中创建到我的 document types
之一的映射。
我的 elasticsearch 索引是 bits
,我的文档类型是 nts
,我正在尝试为 JSON 类型文档中的 3 个 JSON 键分配类型 long
=14=]
即 NT
、XT
和 YT
。
#!/bin/bash
curl -XPUT 'http://localhost:9200/bits/nts/_mapping' -d '
{
"events" : {
"dynamic" : "strict",
"properties" : {
"NT" : {
type : "long"
},
"XT" : {
type : "long"
},
"YT" : {
type : "long"
}
}
},
}'
如果我运行上面的bash脚本,我得到以下错误。
{"error":"ElasticsearchParseException[Failed to parse content to map]; nested: JsonParseException[Unexpected character ('}' (code 125)): was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name\n at [Source: org.elasticsearch.common.compress.lzf.LZFCompressedStreamInput@6d7702cc; line: 17, column: 6]]; ","status":400}
去掉最后一个逗号,把代码改成这样
curl -XPUT 'http://localhost:9200/bits/nts/_mapping' -d '
{
"events" : {
"dynamic" : "strict",
"properties" : {
"NT" : {
type : "long"
},
"XT" : {
type : "long"
},
"YT" : {
type : "long"
}
}
}
}'