# Elasticsearch array of strings filter specific value

**URL:** <https://discuss.elastic.co/t/elasticsearch-array-of-strings-filter-specific-value/79061>\
**Category:** Elasticsearch\
**Created:** [March 17, 2017, 4:44pm UTC](https://discuss.elastic.co/t/elasticsearch-array-of-strings-filter-specific-value/79061 "2017-03-17T16:44:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aniss05](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aniss05/32/25944_2.png) [@aniss05](https://discuss.elastic.co/u/aniss05)\
**Post date:** [March 17, 2017, 4:44pm UTC](https://discuss.elastic.co/t/elasticsearch-array-of-strings-filter-specific-value/79061/1 "2017-03-17T16:44:21Z")

</div>

Hey everyone,  
I am using Elasticsearch 5.2 with Kibana 5.2 and I am inserting my data correctly. The problem is that I have a field called "country\_names" which represents a list of strings and when I want to query for a specific country within this list, the result shows me also the other strings (countries) in the same list. Any idea how to fix this issue? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![eperry](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eperry/32/551_2.png) [@eperry](https://discuss.elastic.co/u/eperry)\
**Post date:** [March 18, 2017, 1:41pm UTC](https://discuss.elastic.co/t/elasticsearch-array-of-strings-filter-specific-value/79061/2 "2017-03-18T13:41:43Z")

</div>

Difficult to say exactly are you talking about Discovery, or Visualizations and how are you looking at the data. A screen shot of your current question might help

Of course I would recommend that you split the field to be a separate record but not sure your needs. The idea with elasticsearch would to have the data in the document the way you want to display it. but that is not always easy or possible

You could always look at script able fields and scripted aggregations  
Try starting here  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-script-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-script-query.html)

[https://www.elastic.co/guide/en/kibana/current/scripted-fields.html](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html)

---

<div class="post-metadata">

**Author:** ![aniss05](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aniss05/32/25944_2.png) [@aniss05](https://discuss.elastic.co/u/aniss05)\
**Post date:** [March 18, 2017, 8:07pm UTC](https://discuss.elastic.co/t/elasticsearch-array-of-strings-filter-specific-value/79061/3 "2017-03-18T20:07:22Z")

</div>

Thanks for your reply and advice a lot. I have looked at the two links you suggested me and also to other links and I found out that the only way is to separate them like you suggested in the first place. Thanks again eperry.

---

<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:** [April 15, 2017, 8:07pm UTC](https://discuss.elastic.co/t/elasticsearch-array-of-strings-filter-specific-value/79061/4 "2017-04-15T20:07:30Z")

</div>

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