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

**URL:** <https://discuss.elastic.co/t/looking-up-values-from-a-diiferent-index-to-the-one-being-searched/362325>\
**Category:** Elastic Search\
**Created:** [July 1, 2024, 10:32pm UTC](https://discuss.elastic.co/t/looking-up-values-from-a-diiferent-index-to-the-one-being-searched/362325 "2024-07-01T22:32:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xef](https://avatars.discourse-cdn.com/v4/letter/x/898d66/32.png) [@xef](https://discuss.elastic.co/u/xef)\
**Post date:** [July 1, 2024, 10:32pm UTC](https://discuss.elastic.co/t/looking-up-values-from-a-diiferent-index-to-the-one-being-searched/362325/1 "2024-07-01T22:32:29Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 2, 2024, 5:30am UTC](https://discuss.elastic.co/t/looking-up-values-from-a-diiferent-index-to-the-one-being-searched/362325/2 "2024-07-02T05:30:56Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/reference/current/enrich-setup.html) based on the location index you have.

---

<div class="post-metadata">

**Author:** ![xef](https://avatars.discourse-cdn.com/v4/letter/x/898d66/32.png) [@xef](https://discuss.elastic.co/u/xef)\
**Post date:** [July 2, 2024, 7:50am UTC](https://discuss.elastic.co/t/looking-up-values-from-a-diiferent-index-to-the-one-being-searched/362325/3 "2024-07-02T07:50:19Z")

</div>

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.

---

<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:** [July 30, 2024, 7:50am UTC](https://discuss.elastic.co/t/looking-up-values-from-a-diiferent-index-to-the-one-being-searched/362325/4 "2024-07-30T07:50:23Z")

</div>

Closed on July 30, 2024, 7:50am UTC

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