Looking up values from a diiferent index to the one being searched

Let's say we have an index for Jobs to be carried out called "jobs". In this index there is a field called localityId which is a string that represnets where the job location is. This string is defined in another index called localities which when looked up gives us the polygon information.

What we would like to do is something like this: Include the Job document in the results if the Locality represented in the Jobs index(by its LocalityId) by looking it up in the localities index (where the polygon is defined for the locality) intersects the circle:

filters.Add(fq => fq.GeoShape(g => g.Shape(b => b.Circle(pro.Location, pro.OperationRadius.ToString())).Relation(GeoShapeRelation.Intersects).IndexedShape(f => f.Id(LocationId).Index("localities").Path("locationShape"))));

But the problem is that we have to provide a single Id (localityId) as opposed to the localityId of each record being evaluated in the jobs index.

Is there any way we can achieve this? Thanks
We would greatly appreciate if the Elastic team could tell us if this is at all possible even if you do not wish to provide the answer so that we can think of some other way.

Elasticsearch does not support joins, which it sounds like you are looking for. In cases like this it is generally recommended to denormalise and store the location information on the job document as well. You might be able to add this at index time using an enrich processor in an ingest pipeline based on the location index you have.

Thanks for your reply.
I was hoping in the same way that one can 'Lookup' as in the snippet I provided, there may be a similar way to do this.

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