如何在ElasticSearch中的单个URI中进行多个搜索查询? [英] How can i do a multiple search query within a single URI in ElasticSearch?
问题描述
我试图通过从Postman发送一个GET http调用来获取索引结果,该调用同时涉及日期范围和我手动添加的字段("log_type"),
I'm trying to get results of an index, by sending an GET http call from Postman for both date range and for a field ("log_type") which I added manually,
因此,当我逐个查询诸如以下内容时,我现在可以获得结果:
So for now I'm able to get the results, when i query it individually such as:
日期范围: http://localhost:9200/dialog_test/_search?q =时间戳:[2016-08-05 + TO + 2016-08-06]
log_type: http://localhost:9200/dialog_test/_search?q =log_type:GetProvisioning%20SUCCESS
log_type: http://localhost:9200/dialog_test/_search?q=log_type:GetProvisioning%20SUCCESS
在上面的URL(log_type)中,GetProvisioning Success是一个log_type.
In the url above (log_type), GetProvisioning Success is a log_type.
所以我想知道的是,如何将它们都合并到一个查询中以识别在特定日期范围和特定log_type之间的结果是什么?
So what I wanted to know is, how can I combine both of them into a single query in order to identify, what're the results between a certain date range and with a specific log_type?
任何帮助都将不胜感激
推荐答案
对于每个 OR
布尔连接.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html"rel =" nofollow>查询字符串.就您而言,您可以执行以下操作:
You can use AND
and OR
boolean conjunctions per query strings. In your case, you can do something like:
curl http://localhost:9200/dialog_test/_search?q=timestamp:[2016-08-05+TO+2016-08-06]+AND+log_type:GetProvisioning+SUCCESS
这篇关于如何在ElasticSearch中的单个URI中进行多个搜索查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!