elasticsearch范围过滤器不正确

时间:2017-03-22 00:55:40

标签: elasticsearch filter range elasticsearch-1.6.0

的所有人。这是一个包含elasitcsearch document url

的简单测试代码
curl -XPOST 'localhost:9200/customer/external/_search?pretty'
  

{         "把" :3,         " TIMED_OUT" :假的,         " _shards" :{           "总" :5,           "成功" :5,           "失败" :0         },         "命中" :{           "总" :2,           " MAX_SCORE" :1.0,           "命中" :[{             " _index" :"客户",             " _type" :"外部",             " _id" :" 1",             " _score" :1.0,             " _source" {"年龄":20,"平衡":100000,"名称":" Thomas.St.Wang& #34;}           },{             " _index" :"客户",             " _type" :"外部",             " _id" :" 2",             " _score" :1.0,             " _source" {"年龄":19,"平衡":10000"名称":" TSW" }           }]         }       }

以下请求不是我期望的结果。这是为什么。

 curl -XPOST 'localhost:9200/customer/external/_search?pretty' -d 



{  
   "query":{  
      "filtered":{  
         "query":{  
            "match_all":{  

            }
         },
         "filter":{  
            "range":{  
               "balance":{  
                  "gte":9999,
                  "lte":100001
               }
            }
         }
      }
   }
}
  

{" take" :2," timed_out" :false," _shards" :{       "总" :5,       "成功" :5,       "失败" :0},"点击" :{       "总" :0,       " MAX_SCORE" : 空值,       "命中" :[]}}

我的查询有什么问题?感谢。

1 个答案:

答案 0 :(得分:0)

 curl -XGET 'localhost:9200/customer/_mapping/external/field/balance'
  

{"顾客" {"映射" {"外部" {"平衡" {" FULL_NAME&# 34;:"平衡""映射" {"平衡" {"类型":"串"} }}}}}}

这就是答案。因为余额是一个字符串。 我需要删除索引,并重新开始索引。