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