# Searching field from different index

**URL:** <https://discuss.elastic.co/t/searching-field-from-different-index/188727>\
**Category:** Elasticsearch\
**Created:** [July 3, 2019, 1:43pm UTC](https://discuss.elastic.co/t/searching-field-from-different-index/188727 "2019-07-03T13:43:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![slovan9](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@slovan9](https://discuss.elastic.co/u/slovan9)\
**Post date:** [July 3, 2019, 1:43pm UTC](https://discuss.elastic.co/t/searching-field-from-different-index/188727/1 "2019-07-03T13:43:31Z")

</div>

Hello,  
Im new to Elasticsearch and I cannot solve following issue. Ive checked many links but without success. My issue: I have two indexes. First contains field "City" where cities like London or Paris are stored (almost 7000 cities). Second one includes field with short text messages and its name is "message" (data type: text). And I would like to make query that will be able to find occurence of all cities in the "message" field. Any hands or clues how to start? Thanks a lot in advance. Maybe the solution will be easy and maybe not 🙂

---

<div class="post-metadata">

**Author:** ![gabriel\_tessier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabriel_tessier/32/27911_2.png) [@gabriel\_tessier](https://discuss.elastic.co/u/gabriel_tessier)\
**Post date:** [July 4, 2019, 8:31am UTC](https://discuss.elastic.co/t/searching-field-from-different-index/188727/2 "2019-07-04T08:31:44Z")

</div>

Hi @slovan9,

May I suggest you to check for terms lookup, it seem to match your need, I never tried.  
[https://www.elastic.co/guide/en/elasticsearch/reference/7.2/query-dsl-terms-query.html#query-dsl-terms-lookup](https://www.elastic.co/guide/en/elasticsearch/reference/7.2/query-dsl-terms-query.html#query-dsl-terms-lookup)

Other solution can be making a script to extract your cities then loop through each 100~500 cities and get your messages.

---

<div class="post-metadata">

**Author:** ![slovan9](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@slovan9](https://discuss.elastic.co/u/slovan9)\
**Post date:** [July 12, 2019, 1:42pm UTC](https://discuss.elastic.co/t/searching-field-from-different-index/188727/3 "2019-07-12T13:42:20Z")

</div>

Thanks for answer and help. I tried Terms but it seems to me it doesnt work with text fields. I made queries according to the manual but without success. I will try it one more time and I will see.

---

<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:** [August 9, 2019, 1:42pm UTC](https://discuss.elastic.co/t/searching-field-from-different-index/188727/4 "2019-08-09T13:42:21Z")

</div>

Closed on August 9, 2019, 1:42pm UTC

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