List of servers by sense

Hello Guys
Is possible with curl command or sense get a list with server by query with the hostname?.
For example, the following command is for search by hostname:

GET /logstash-2016.03.08/Nxlogs/_search?pretty
{
  "query": {
    "query_string": {
      "default_field": "hostname",
      "query": "SERVER1"
    }
  }
}

If I'll replace the name of server by * , I can see a list but I receive the same name of server many times and I want receive 1 name for each server.

Thank you.

Hi,

You probably want to use either a cardinality or terms aggregation:

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html

This is what I need.

Thank you!