我的弹性搜索查询中如何使用MySQL IN子句? [英] How could I have MySQL IN clause within my elasticsearch query?

查看:160
本文介绍了我的弹性搜索查询中如何使用MySQL IN子句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



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



HTTP://本地主机:9200 / response_summary / _search q = API: 位置 + AND + transactionoperationstatus: 带电 + AND + operatorid = 'DIALOG' + AND +用户ID:测试+ AND +时间:2015-05-27



在上面,我应该可以附加 AND responseCode IN(401,403)。我尝试在网络上搜索,但找不到任何解决方案。



任何帮助都可以被忽略。

解决方案

只需追加其中之一:




  • 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)
pre>

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.

解决方案

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)

这篇关于我的弹性搜索查询中如何使用MySQL IN子句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆