本文介绍了Lucene Query String Elasticsearch“小于或等于”[URI搜索]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在这么多网站上,他们教导如何使用范围查询来查询Elasticsearch中的数据。我想使用Lucene样式查询字符串从Elasticsearch查询小于或等于某个数字的数据。 fieldname:[* TO 100]
或
字段名称:[*TO100]
我已经尝试过其他格式,但没有一个工作。有人可以帮助我吗?解决方案你将要使用查询字符串语法()范围与URI搜索结合()
$ curl -XGET
' http:// localhost:9200 / twitter / tweet / _search?q = user:kimchy'
On so many websites they teach how to query data from Elasticsearch using range query. I would like to query data that is less than or equal to a certain number from Elasticsearch using Lucene Style Query String like this.
fieldname:[* TO 100]
or
fieldname:["*" TO "100"]
I have tried in other formats but none of those worked. Can someone help me?
解决方案 You will want to use Query String Syntax (http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html) ranges combined with the URI Search (http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-uri-request.html)
$ curl -XGET
'http://localhost:9200/twitter/tweet/_search?q=user:kimchy'
这篇关于Lucene Query String Elasticsearch“小于或等于”[URI搜索]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!