我試圖在elasticsearch中建立一個索引,然後搜索數字字段。結果集是空的,即使你的邏輯結果是有一個記錄結果集。Elasticsearch中的數字範圍/過濾器
下面的操作來再現(使用感)
創建索引
PUT playground
創建
POST playground/doc
{
"value": {
"textlabel": "Lorem Ipsum",
"numerlabel": 37.0,
"datelabel":"1978-10-26T00:00:00+02:00"
}
}
自動生成的映射文件似乎提供了一個文件正確的數據類型
{
"playground": {
"mappings": {
"doc": {
"properties": {
"value": {
"properties": {
"datelabel": {
"type": "date",
"format": "dateOptionalTime"
},
"numerlabel": {
"type": "double"
},
"textlabel": {
"type": "string"
}
}
}
}
}
}
}
}
上的日期範圍搜索工作正常,返回預期數據
POST playground/doc/_search
{
"query": {
"filtered": {
"filter": {
"range" : {
"value.datelabel" : {
"lte": "now-28y"
}
}
}
}
}
}
但數值範圍不
返回任何結果POST playground/doc/_search
{
"query": {
"filtered": {
"filter": {
"range": {
"value.numberlabel" : {
"lte": 100
}
}
}
}
}
}
結果
{ "took": 1, "timed_out": false, "_shards": { "total": 5, "successful": 5, "failed": 0 }, "hits": { "total": 0, "max_score": null, "hits": [] } }
任何建議爲什麼?
謝謝安德烈 - 我檢查了100次查詢的拼寫......但沒有看文檔的創建。非常感謝! –