How could I have MySQL IN clause within my elasticsearch query?

冷暖自知 提交于 2019-12-02 17:23:18

问题


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.

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"

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.

Any help could be appreaciated.


回答1:


Simply append either of these:

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

Like this:

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)


来源:https://stackoverflow.com/questions/39761988/how-could-i-have-mysql-in-clause-within-my-elasticsearch-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!