问题
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:
Date Range: http://localhost:9200/dialog_test/_search?q=timestamp:[2016-08-05+TO+2016-08-06]
log_type: http://localhost:9200/dialog_test/_search?q=log_type:GetProvisioning%20SUCCESS
In the url above (log_type), GetProvisioning Success is a 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?
Any help could be appreciated
回答1:
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
回答2:
Also, you could use the source query string parameter in order to pass the body directly in the URL. For example:
http://localhost:9200/my_index/_search?source={"query": {"match_all": {}},"size": "1","sort": [{"@timestamp": {"order": "desc"}}]}
来源:https://stackoverflow.com/questions/39470511/how-can-i-do-a-multiple-search-query-within-a-single-uri-in-elasticsearch