# List of servers by sense

**URL:** <https://discuss.elastic.co/t/list-of-servers-by-sense/48579>\
**Category:** Elasticsearch\
**Created:** [April 27, 2016, 5:40pm UTC](https://discuss.elastic.co/t/list-of-servers-by-sense/48579 "2016-04-27T17:40:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juan\_Andres\_Ramirez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan_andres_ramirez/32/9467_2.png) [@Juan\_Andres\_Ramirez](https://discuss.elastic.co/u/Juan_Andres_Ramirez)\
**Post date:** [April 27, 2016, 5:40pm UTC](https://discuss.elastic.co/t/list-of-servers-by-sense/48579/1 "2016-04-27T17:40:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![msimos](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@msimos](https://discuss.elastic.co/u/msimos)\
**Post date:** [April 27, 2016, 6:42pm UTC](https://discuss.elastic.co/t/list-of-servers-by-sense/48579/2 "2016-04-27T18:42:00Z")

</div>

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-metrics-cardinality-aggregation.html)  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html)

---

<div class="post-metadata">

**Author:** ![Juan\_Andres\_Ramirez](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/juan_andres_ramirez/32/9467_2.png) [@Juan\_Andres\_Ramirez](https://discuss.elastic.co/u/Juan_Andres_Ramirez)\
**Post date:** [April 27, 2016, 7:47pm UTC](https://discuss.elastic.co/t/list-of-servers-by-sense/48579/3 "2016-04-27T19:47:58Z")

</div>

This is what I need.

Thank you!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:55pm UTC](https://discuss.elastic.co/t/list-of-servers-by-sense/48579/4 "2017-07-05T22:55:47Z")

</div>


