Need which exact value matched in an array


#1

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.

_


(Simon Willnauer) #2

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
[2] https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-api-reference.html


(system) #3

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