0

I have this URL string:

curl -XGET "http://es.host.com:9200/filebeat/_search?q=type:MEMORYUSE&size=100&pretty=true")

It works like I want, but now I would like to limit the MEMORYUSE to only return one host. Example I would like to use the sting above to pull back MEMORYUSE for only server darthvader. Right now I get all servers and I would like to limit to only the server I need.

Thank you in advance for any guidance you can provide.

Wayne

Wayne
  • 125
  • 3

1 Answers1

0

the query_string query supports a syntax like type:MEMORYUSE AND host:darthvader - however when you are using spaces you may need to URL encode those, if you put everything in there.

You should use a request body to put your query in there, like

curl -X GET 'http://.../_search' -d '{ "query" : { "query_string" : { "query" : "type:MEMORYUSE" } } }'

This also allows you to do much more powerful queries. See request body search in the docs

alr
  • 1,744
  • 1
  • 10
  • 11