# Selecting only specific data in a nested field

**URL:** <https://discuss.elastic.co/t/selecting-only-specific-data-in-a-nested-field/163714>\
**Category:** Elasticsearch\
**Created:** [January 10, 2019, 10:58am UTC](https://discuss.elastic.co/t/selecting-only-specific-data-in-a-nested-field/163714 "2019-01-10T10:58:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LoZio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lozio/32/25946_2.png) [@LoZio](https://discuss.elastic.co/u/LoZio)\
**Post date:** [January 10, 2019, 10:58am UTC](https://discuss.elastic.co/t/selecting-only-specific-data-in-a-nested-field/163714/1 "2019-01-10T10:58:21Z")

</div>

Hi, I have a nested field from a survey where a user can select several nations, so it may be empty, contain a single nation or several nations. Basically an array from 0 to n elements from logstash parse.  
I can easily select all the docs containing Italy, and using the filters Italy AND Germany or Italy BUT NOT Germany. I have two questions:

- How can I select only docs containing ONLY Italy and not other nations?
- How can I find the most popular combo (say Italy and Germany)?

I want to clarify that it is NOT a single string field, it is an array/nested type. Originally was something like "Nation1;Nation2;Nation3" and was split during logstash import.  
Thanks

---

<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:** [February 7, 2019, 10:58am UTC](https://discuss.elastic.co/t/selecting-only-specific-data-in-a-nested-field/163714/2 "2019-02-07T10:58:35Z")

</div>

Closed on February 7, 2019, 10:58am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
