Geo distance aggregation on array location fields

Is it possible to get an exact term count on the number for location matches within one document. Eg
Say I have location (geo_point) indexed documents such as

Document. 1 has location:[latlon_1, latlon_2]
Document 2 has location :[latlon_3, latlon_4]
I want to do a geo distance aggregation filter on a particular radius and return counts of documents that match for example atleast 2 locations per document.

This means we have to somehow get how many matches per document not just if any matched.

Is this possible? I researched and came up empty

Thanks in advance

I don't believe so, it'd just be a match per doc.

Can you split the documents apart?

Ok thanks for the reply.

Those locations exist in an array of nested documents. Internally Nested docs are indexed separately from what i gather. i don't know it this helps.

The query we are trying to achieve is find out documents where location a and location b happened exactly one time.

It is too costly to split those documents. Also having all location coalesced per document gives us the ability to do location intersection kind of queries.

Could this be achieved using script or custom query. I am willing to investigate/implement if this is possible and kindly point me to the right direction.


They are, but it doesn't as that's simply an abstraction when we interact with Lucene.

Costly in what sense?

Fair point, what about having multiple representations of the document then, to solve the various requirements?

Let me see if I can get some input from someone with more geo expertise than me :slight_smile:

1 Like

Ok thank you.

It is costly because these documents are in the billions and multiple terabytes and breaking it up will explode it even more plus we lose functionality that way.. It is simply not viable as a pipeline to hold multiple representation of it. It would be great if there are something custom I could do.

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