1
我已經映射一個字段很長,但輸入數據是十進制(100.123
)。彈性搜索範圍不能用於雙索引只要
我試過任何range
搜索,它不起作用。我已驗證數據是否在適當的索引中,如果我搜索失蹤/存在,我可以找到它們。
範圍查詢:
"range": {
"nr_val": {
"from": 123,
"to": 1234
}
}
是Elasticsearch只是忽略值,將它們視爲字符串的範圍搜索?
所以在我的情況下,我可以做些什麼來做一個範圍搜索from:100, to:200
工作100.123除了一個完整的轉儲和重新導入?有沒有可用的轉換選項?
與更新詳細規格
{
"state": "open",
"settings": {
"index": {
"creation_date": "1447858537098",
"number_of_shards": "5",
"uuid": "iiPzQXasQadvnDF1da8oMw",
"version": {
"created": "1070299"
},
"number_of_replicas": "1"
}
},
"mappings": {
"mongo_doc": {
"properties": {
"parent": {
"type": "string"
},
"data.current.specs.nr._nrm_val": {
"type": "double"
},
"data.current.specs.nr_b._nrm_val": {
"type": "double"
},
"data": {
"properties": {
"current": {
"properties": {
"specs": {
"properties": {
"nr": {
"properties": {
"_nrm_val": {
"type": "double"
}
}
},
"nr_b": {
"properties": {
"_nrm_val": {
"type": "long"
}
}
}
}
}
}
}
}
}
}
}
},
"aliases": []
}
似乎映射是不完全正確......切換到['data']['properties']['current']['properties'](...)
符號。
如果我將其標記爲「double」,100.123的索引值是100?現在什麼時候價值很高? –
反過來:作爲'long',索引值是'100'。由於'double'是正確的小數。 –
那麼爲什麼範圍搜索沒有工作?我失去小數沒有問題。我已將代碼示例添加到問題中。 –