elasticsearch - 使用多字段条件在GET中搜索

标签 elasticsearch search get

我想依靠GET请求执行elasticsearch查询。

该查询成功地使我能够看到索引内发给特定发件人的所有消息(即sender.id ==一些值)。

http://localhost:9200/myindex/messages/_search?q=sender.id:user1  

现在,我想添加一个新字段。在我的案例研究中,仅检索 bool(boolean) 值设置为true的消息。所以我尝试了:
http://localhost:9200/myindex/messages/_search?q=sender.id:user1&received:true

但这是行不通的,而且我找不到任何有关如何使用多字段执行GET查询的文档/示例。

请注意,接收到的参数存在,始终设置并且在单独使用时可以正常工作。

最佳答案

q参数采用Lucene查询语法。

因此,要添加其他条件,请使用以下命令:

http://localhost:9200/myindex/messages/_search?q=sender.id:user1%20AND%20received:true

关于elasticsearch - 使用多字段条件在GET中搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54086254/

相关文章:

python - Flask request.args.get 没有获取所有参数(Python)

elasticsearch - Spring Data Elasticsearch 自动重连

node.js - 如何查询文档中应包含and子句的文档?

elasticsearch - 我应该将 elasticsearch 用于审计日志吗?

MYSQL - 不同数据库中的两个表

python - Pyocr 无法识别 get_available_languages

elasticsearch - ElasticSearch映射问题-嵌套到非嵌套

sql - 在 Stackoverflow 上进行类似于 "Related Questions"的搜索使用的 SQL 是什么

java - Elasticsearch : RemoteTransportException in Paginated search for more than 10000 results

ios - Alamofire GET 请求无法正常工作