0
我是弹性搜索的新手,我一直在过去几天试验它。我无法做适当的映射,因为我在映射中提到的所有数据类型都被映射为类型“字”而不是各自的类型。这是我做了弹性搜索“单词”数据类型:映射不正确
POST my_index
{
"settings" : {
"analysis" : {
"analyzer" : {
"lowercase_analyzer" : {
"type" : "custom",
"tokenizer" : "keyword",
"filter" : ["lowercase"]
}
}
}
},
"mappings" : {
"my_type" : {
"properties" : {
"name" : {"type" : "string" ,"index" : "not_analyzed" },
"field0" : {
"properties" : {
"field1" : {"type" : "boolean" },
"field2" : {"type" : "string" },
"field3" : {"type" : "date", "format" : "yyyy-MM-dd HH:mm:ss SSSSSS" }
}
}
}
}
}
}
要测试的映射贴图,我如下
GET my_index/_analyze
{
"field" : "name",
"text" : "10.90.99.6"
}
这给了我下面的结果
{
"tokens": [
{
"token": "10.90.99.6",
"start_offset": 0,
"end_offset": 10,
"type": "word",
"position": 0
}
]
}
我使用“_analyze” API期望结果中的“类型”是“字符串”。不过,我不明白为什么它返回的类型“单词”。当我使用_analyze api在嵌套字段中发布布尔类型或时间戳的数据时,其他字段也会发生同样的情况。
GET my_index/_analyze
{
"field" : "field0.field1",
"text" : "true"
}
结果
{
"tokens": [
{
"token": "true",
"start_offset": 0,
"end_offset": 4,
"type": "word",
"position": 0
}
]
}
我在哪里我的测绘做错了。
另外,在elastic search reference api中没有这样的“字”数据类型。
谢谢。它有帮助。 –
很酷。很高兴帮助! – Val