Searching field from different index

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 :slight_smile:

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

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

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.

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