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

查看:42
本文介绍了如何在我的 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)

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

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