# Multilinqual queries in ElasticSearch

**URL:** <https://discuss.elastic.co/t/multilinqual-queries-in-elasticsearch/5379>\
**Category:** Elasticsearch\
**Created:** [September 14, 2011, 3:03am UTC](https://discuss.elastic.co/t/multilinqual-queries-in-elasticsearch/5379 "2011-09-14T03:03:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pavel](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@Pavel](https://discuss.elastic.co/u/Pavel)\
**Post date:** [September 14, 2011, 3:03am UTC](https://discuss.elastic.co/t/multilinqual-queries-in-elasticsearch/5379/1 "2011-09-14T03:03:00Z")

</div>

Let's say we have the following mapping in ElasticSearch.

{  
"content": {  
"properties": {  
"id": {  
"type": "string",  
"index": "not\_analyzed",  
"store": "yes"  
},  
"locale\_container": {  
"type": "object",  
"properties": {  
"english": {  
"type": "object",  
"properties": {  
"title": {  
"type": "string",  
"index\_analyzer": "english",  
"search\_analyzer": "english",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
},  
"text": {  
"type": "string",  
"index\_analyzer": "english",  
"search\_analyzer": "english",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
}  
}  
},  
"german": {  
"type": "object",  
"properties": {  
"title": {  
"type": "string",  
"index\_analyzer": "german",  
"search\_analyzer": "german",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
},  
"text": {  
"type": "string",  
"index\_analyzer": "german",  
"search\_analyzer": "german",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
}  
}  
},  
"russian": {  
"type": "object",  
"properties": {  
"title": {  
"type": "string",  
"index\_analyzer": "russian",  
"search\_analyzer": "russian",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
},  
"text": {  
"type": "string",  
"index\_analyzer": "russian",  
"search\_analyzer": "russian",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
}  
}  
},  
"italian": {  
"type": "object",  
"properties": {  
"title": {  
"type": "string",  
"index\_analyzer": "italian",  
"search\_analyzer": "italian",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
},  
"text": {  
"type": "string",  
"index\_analyzer": "italian",  
"search\_analyzer": "italian",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
}  
}  
}  
}  
}  
}  
}  
}

When a particular user queries the index, we can take her culture from  
her settings, i.e. we know which analyzer to use. How can we formulate  
a query which will search only "title" and "text" fields in her own  
language (let's say, German) and use German analyzer to tokenize the  
search query?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 14, 2011, 6:20am UTC](https://discuss.elastic.co/t/multilinqual-queries-in-elasticsearch/5379/2 "2011-09-14T06:20:37Z")

</div>

What happens if you make search on content.locale\_container.english.text  
field or content.locale\_container.german.text ?  
Something like :

{  
"query" : {  
"term" : { "content.locale\_container.english.text" : "my english  
words" }  
}  
}

HTH  
David

-----Message d'origine-----  
De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)]  
De la part de Pavel  
Envoyé : mercredi 14 septembre 2011 05:03  
À : elasticsearch  
Objet : Multilinqual queries in ElasticSearch

Let's say we have the following mapping in ElasticSearch.

{  
"content": {  
"properties": {  
"id": {  
"type": "string",  
"index": "not\_analyzed",  
"store": "yes"  
},  
"locale\_container": {  
"type": "object",  
"properties": {  
"english": {  
"type": "object",  
"properties": {  
"title": {  
"type": "string",  
"index\_analyzer": "english",  
"search\_analyzer": "english",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
},  
"text": {  
"type": "string",  
"index\_analyzer": "english",  
"search\_analyzer": "english",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
}  
}  
},  
"german": {  
"type": "object",  
"properties": {  
"title": {  
"type": "string",  
"index\_analyzer": "german",  
"search\_analyzer": "german",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
},  
"text": {  
"type": "string",  
"index\_analyzer": "german",  
"search\_analyzer": "german",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
}  
}  
},  
"russian": {  
"type": "object",  
"properties": {  
"title": {  
"type": "string",  
"index\_analyzer": "russian",  
"search\_analyzer": "russian",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
},  
"text": {  
"type": "string",  
"index\_analyzer": "russian",  
"search\_analyzer": "russian",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
}  
}  
},  
"italian": {  
"type": "object",  
"properties": {  
"title": {  
"type": "string",  
"index\_analyzer": "italian",  
"search\_analyzer": "italian",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
},  
"text": {  
"type": "string",  
"index\_analyzer": "italian",  
"search\_analyzer": "italian",  
"index": "analyzed",  
"term\_vector": "with\_positions\_offsets",  
"store": "yes"  
}  
}  
}  
}  
}  
}  
}  
}

When a particular user queries the index, we can take her culture from  
her settings, i.e. we know which analyzer to use. How can we formulate  
a query which will search only "title" and "text" fields in her own  
language (let's say, German) and use German analyzer to tokenize the  
search query?

---

<div class="post-metadata">

**Author:** ![Jan\_Fiedler](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jan_fiedler/32/2518_2.png) [@Jan\_Fiedler](https://discuss.elastic.co/u/Jan_Fiedler)\
**Post date:** [September 14, 2011, 7:24am UTC](https://discuss.elastic.co/t/multilinqual-queries-in-elasticsearch/5379/3 "2011-09-14T07:24:52Z")

</div>

A term query (as shown above) would not use an analyzer (I think). You  
probably need to go with the text query family:

{  
"query" : {  
"text" : { "content.locale\_container.english.text" : "my english  
words" }  
}  
}

Based on your mapping, ES would lookup the correct search analyzer for the  
field 'content.locale\_container.english.text' and use it to analyze your  
query 'my english words'. In other words, the correct analyzer is identified  
based on the field you query on (via the mapping definition).

---

<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 6, 2017, 3:54am UTC](https://discuss.elastic.co/t/multilinqual-queries-in-elasticsearch/5379/4 "2017-07-06T03:54:27Z")

</div>


