ElasticSearch范围查询(英文检索)
生活随笔
收集整理的這篇文章主要介紹了
ElasticSearch范围查询(英文检索)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
#根據日期范圍查詢
#范圍查詢 GET /lib3/user/_search {"query": {"range": {"birthday": {"from": "1990-10-10","to": "2020-03-15"}}} } {"took" : 24,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 3,"max_score" : 1.0,"hits" : [{"_index" : "lib3","_type" : "user","_id" : "2","_score" : 1.0,"_source" : {"name" : "zhaoming","address" : "bei jing hai dian qu qing he zhen","age" : 20,"birthday" : "1998-10-12","interests" : "xi huan hejiu, duanlian, changge"}},{"_index" : "lib3","_type" : "user","_id" : "4","_score" : 1.0,"_source" : {"name" : "wangwu","address" : "bei jing hai dian qu qing he zhen","age" : 26,"birthday" : "1995-10-12","interests" : "xi huan biancheng, tingyinyue, lvyou"}},{"_index" : "lib3","_type" : "user","_id" : "3","_score" : 1.0,"_source" : {"name" : "lisi","address" : "bei jing hai dian qu qing he zhen","age" : 23,"birthday" : "1998-10-12","interests" : "xi huan hejiu,duanlian, changge"}}]} }#include_lower ?設置為true ?包含最小值? ? ? ? ? ? #include_upper ?設置為false 不包含最大值?
#include_lower 設置為true 包含最小值 #include_upper 設置為false 不包含最大值 GET /lib3/user/_search {"query": {"range": {"age": {"from": 20,"to": 25,"include_lower": true,"include_upper": false}}} } {"took" : 2,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 2,"max_score" : 1.0,"hits" : [{"_index" : "lib3","_type" : "user","_id" : "2","_score" : 1.0,"_source" : {"name" : "zhaoming","address" : "bei jing hai dian qu qing he zhen","age" : 20,"birthday" : "1998-10-12","interests" : "xi huan hejiu, duanlian, changge"}},{"_index" : "lib3","_type" : "user","_id" : "3","_score" : 1.0,"_source" : {"name" : "lisi","address" : "bei jing hai dian qu qing he zhen","age" : 23,"birthday" : "1998-10-12","interests" : "xi huan hejiu,duanlian, changge"}}]} }?
?
總結
以上是生活随笔為你收集整理的ElasticSearch范围查询(英文检索)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java-两数倒置后求和
- 下一篇: Tomcat运行出现出现问题(the J