[英]elasticsearch range filter incorrect
大家。 這是帶有elasitcsearch文檔url的簡單測試代碼
curl -XPOST 'localhost:9200/customer/external/_search?pretty'
{“ took”:3,“ timed_out”:false,“ _shards”:{“ total”:5,“ successful”:5,5,“ failed”:0},“ hits”:{“ total”:2,“ max_score “:1.0,” hits“:[{”“ _index”:“客戶”,“ _type”:“外部”,“ _id”:“ 1”,“ _score”:1.0,“ _source”:{“ age”:20 ,“ balance”:100000,“ name”:“ Thomas.St.Wang”}},{“ _index”:“客戶”,“ _type”:“外部”,“ _id”:“ 2”,“ _score”: 1.0,“ _source”:{“ age”:19,“ balance”:10000,“ name”:“ TSW”}}]}}
以下請求不是我期望的結果。 為什么。
curl -XPOST 'localhost:9200/customer/external/_search?pretty' -d
{
"query":{
"filtered":{
"query":{
"match_all":{
}
},
"filter":{
"range":{
"balance":{
"gte":9999,
"lte":100001
}
}
}
}
}
}
{“ took”:2,“ timed_out”:false,“ _shards”:{“ total”:5,“ successful”:5,“ failed”:0},“ hits”:{“ total”:0,“ max_score “:null,” hits“:[]}}
我的查詢出了什么問題? 謝謝。
curl -XGET 'localhost:9200/customer/_mapping/external/field/balance'
{ “顧客”:{ “映射”:{ “外部”:{ “平衡”:{ “FULL_NAME”: “平衡”, “映射”:{ “平衡”:{ “類型”: “串”}}}} }}}
這就是答案。 因為提起的余額是一個字符串。 我需要刪除索引,然后重新啟動索引。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.