如何在基于URI的查询中指定AND操作?我正在寻找类似这样的东西:
http://localhost:9200/_search?q="profiletype:student AND username:s*"
发布于 2012-12-05 14:00:42
根据文档,它应该按照您所描述的那样工作。请参阅http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html
也就是说,您还可以使用以下内容:
http://localhost:9200/_search?q="+profiletype:student +username:s*"
发布于 2014-01-10 18:12:43
对于ElasticSearch中的URI search,您可以使用AND运算符profiletype:student AND username:s
,正如您所说的,但不带引号:
_search?q=profiletype:student AND username:s*
还可以将缺省运算符设置为AND
_search?q=profiletype:student username:s*&default_operator=AND
或者,您可以对必须存在的术语使用+
operator,即使用+profiletype:student +username:s
作为查询字符串。但是,如果没有URL编码,这是不起作用的。在URL编码中,+
是%2B
,空格是%20
,因此另一种方法是
_search?q=%2Bprofiletype:student%20%2Busername:s*
发布于 2017-06-14 04:00:02
你可以试试下面的线路。
http://localhost:9200/_search?q=profiletype:student%20AND%20username:s*
http://localhost:9200/_search?q=profiletype:student AND username:s*
https://stackoverflow.com/questions/13716719
复制相似问题