如何在我的 elasticsearch 查询中使用 MySQL IN 子句?

我正在尝试将 elasticsearch 查询作为 GET 请求执行,以便从我创建的索引中提取数据.索引中的数据是一个来自MySQL DB的表,通过logstash配置.

I'm trying perform an elasticsearch query as a GET request in order pull data from the index which I created. The data which is in the index is, a table from MySQL DB, configured though logstash.

这是我没有 IN 子句的请求:

Here is my request without the IN clause:

http://localhost:9200/response_summary/_search?q=api:"location"+AND+transactionoperationstatus:"charged"+AND+operatorid='DIALOG'+AND+userid:test+AND+time:"2015-05-27"

在上面,我应该能够附加AND responseCode IN (401,403).我尝试在网上搜索它,但找不到任何解决方案.

In the above, I should be able to append AND responseCode IN (401,403). I tried giving it a search on the web, but couldn't find any solutions.

可以提供任何帮助.

推荐答案

只需添加其中一个:

  • responseCode:(401 403)
  • responseCode:(401 OR 403)
  • responseCode:(401 || 403)

像这样:

http://localhost:9200/response_summary/_search?q=api:"location"+AND+transactionoperationstatus:"charged"+AND+operatorid='DIALOG'+AND+userid:test+AND+time:"2015-05-27"+AND+responseCode:(401+403)

相关文章