Index relationship

i need help to work around problem. I have 2 files one with a number field and the other with country code and country name.

for example i have this number 12398564 and there is the country code 123 of country name x

My questions is should i index both files in the same index so i can use use them
my final result is that i want to take the substring of the code which returns 123 and link it with country code field 123 and returns the country name x to display it in a table next to it.
can i use scripted fields or something of a link?

Elasticsearch does not support joins, so the is not possible. I would instead recommend looking up the country code and country name before indexing the document and then store it together with the data. Denormalising data this way is very common when working with Elasticsearch.

im am indexing using logstash is there a way to do this with logstash

You should be able to use a translate filter plugin to perform this, as this supports pattern matching. For performance reasons you may however want to instead break it up into several filters as country codes can have different lengths.

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