# Need which exact value matched in an array

**URL:** <https://discuss.elastic.co/t/need-which-exact-value-matched-in-an-array/111400>\
**Category:** Elasticsearch\
**Created:** [December 12, 2017, 5:54pm UTC](https://discuss.elastic.co/t/need-which-exact-value-matched-in-an-array/111400 "2017-12-12T17:54:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pokaleshrey](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pokaleshrey/32/48680_2.png) [@pokaleshrey](https://discuss.elastic.co/u/pokaleshrey)\
**Post date:** [December 12, 2017, 5:54pm UTC](https://discuss.elastic.co/t/need-which-exact-value-matched-in-an-array/111400/1 "2017-12-12T17:54:05Z")

</div>

Hi all,  
I have many documents in my index.  
Each document is having a field "location" which is an array of geo\_points.

I query ES by the geo\_distance query with a lat,lon as input & say 50m radius.  
When i get result i am unable to guess which of the points in the array are in the 50m radius that i have specified (unless i go and check manually).

This case is quite similar to matching a text in a field which is an array. I am unable to tell which value has matched.

**Possible solution that needs inputs:**  
I can match the input field by iterating the array of field. But that only work if the input value is exactly same as that in array. In case if the input value is an analyzed token its not possible to match the input value with that in array.  
\_

> Please help, its a very critical problem we are facing throughout our application.

\_

---

<div class="post-metadata">

**Author:** ![s1monw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s1monw/32/3637_2.png) [@s1monw](https://discuss.elastic.co/u/s1monw)\
**Post date:** [December 15, 2017, 10:20am UTC](https://discuss.elastic.co/t/need-which-exact-value-matched-in-an-array/111400/2 "2017-12-15T10:20:01Z")

</div>

I wonder if you can use a script field [1] and use painless to filter out the points that don't match with painless? The painless reference [2] for org.elasticsearch.index.fielddata.ScriptDocValues.GeoPoints offers sufficient methods.

[1] [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-script-fields.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-script-fields.html)  
[2] [https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-api-reference.html](https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-api-reference.html)

---

<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:** [January 12, 2018, 10:20am UTC](https://discuss.elastic.co/t/need-which-exact-value-matched-in-an-array/111400/3 "2018-01-12T10:20:20Z")

</div>

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