Supporting multiple languages in elasticsearch

I want to know how to return the response based on site language. for example:

"name": {
       "en": "Berlin",
       "nl": "Berlijn",
}

The site language is "nl", so the name field value should be return as "Berlijn" Is that possible to implement in elasticsearch?

note that I want the user to search in both language but the response value will show based on site language.

Thanks in advance

I believe this is something you better solve in your application as probably you are not exposing directly elasticsearch to the end user, right?

But if you really want to, you might want to use filter_path: https://www.elastic.co/guide/en/elasticsearch/reference/current/common-options.html#common-options-response-filtering

Like

GET /_search?q=elasticsearch&filter_path=hits.hits._source.name.nl

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