# Index with documents in multiple languages

**URL:** <https://discuss.elastic.co/t/index-with-documents-in-multiple-languages/7398>\
**Category:** Elasticsearch\
**Created:** [April 19, 2012, 1:01pm UTC](https://discuss.elastic.co/t/index-with-documents-in-multiple-languages/7398 "2012-04-19T13:01:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bogdanionescu](https://avatars.discourse-cdn.com/v4/letter/b/7cd45c/32.png) [@bogdanionescu](https://discuss.elastic.co/u/bogdanionescu)\
**Post date:** [April 19, 2012, 1:01pm UTC](https://discuss.elastic.co/t/index-with-documents-in-multiple-languages/7398/1 "2012-04-19T13:01:54Z")

</div>

Hello. I would like to index some documents, keep them in the same index,  
but the documents are in different languages.  
I'm thinking I must use a specific analyzer for each language. Should I  
declare a mapping with a different type for each language and at index time  
I specify that specific type?  
Could this be done simpler? Thank you!

---

<div class="post-metadata">

**Author:** ![bogdanionescu](https://avatars.discourse-cdn.com/v4/letter/b/7cd45c/32.png) [@bogdanionescu](https://discuss.elastic.co/u/bogdanionescu)\
**Post date:** [April 19, 2012, 3:51pm UTC](https://discuss.elastic.co/t/index-with-documents-in-multiple-languages/7398/2 "2012-04-19T15:51:15Z")

</div>

I'm looking at dynamic\_templates feature. Can this be used to choose  
specify a different analyzer based on a field value? Like a "language"  
field in the document?

joi, 19 aprilie 2012, 16:01:54 UTC+3, Raaadu a scris:

> Hello. I would like to index some documents, keep them in the same index,  
> but the documents are in different languages.  
> I'm thinking I must use a specific analyzer for each language. Should I  
> declare a mapping with a different type for each language and at index time  
> I specify that specific type?  
> Could this be done simpler? Thank you!

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [April 19, 2012, 5:54pm UTC](https://discuss.elastic.co/t/index-with-documents-in-multiple-languages/7398/3 "2012-04-19T17:54:46Z")

</div>

You can specify analyzer name in a  
field: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/analyzer-field.html)

On Thursday, April 19, 2012 11:51:15 AM UTC-4, Raaadu wrote:

> I'm looking at dynamic\_templates feature. Can this be used to choose  
> specify a different analyzer based on a field value? Like a "language"  
> field in the document?
> 
> joi, 19 aprilie 2012, 16:01:54 UTC+3, Raaadu a scris:
> 
> > Hello. I would like to index some documents, keep them in the same index,  
> > but the documents are in different languages.  
> > I'm thinking I must use a specific analyzer for each language. Should I  
> > declare a mapping with a different type for each language and at index time  
> > I specify that specific type?  
> > Could this be done simpler? Thank you!

---

<div class="post-metadata">

**Author:** ![bogdanionescu](https://avatars.discourse-cdn.com/v4/letter/b/7cd45c/32.png) [@bogdanionescu](https://discuss.elastic.co/u/bogdanionescu)\
**Post date:** [April 20, 2012, 6:59am UTC](https://discuss.elastic.co/t/index-with-documents-in-multiple-languages/7398/4 "2012-04-20T06:59:36Z")

</div>

You are right, and that is the feature I want to use. But I'll have  
documents on all the languages and I'm asking if maybe there is another way  
to to this beside defining a type for each document in a different language.  
So dynamic mappings seem a cool feature, but I was wondering if I can vary  
the language using a field value or I should vary a special field name in  
order to dynamic map that document to a certain analyser

joi, 19 aprilie 2012, 20:54:46 UTC+3, Igor Motov a scris:

> You can specify analyzer name in a field:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/analyzer-field.html)
> 
> On Thursday, April 19, 2012 11:51:15 AM UTC-4, Raaadu wrote:
> 
> > I'm looking at dynamic\_templates feature. Can this be used to choose  
> > specify a different analyzer based on a field value? Like a "language"  
> > field in the document?
> > 
> > joi, 19 aprilie 2012, 16:01:54 UTC+3, Raaadu a scris:
> > 
> > > Hello. I would like to index some documents, keep them in the same  
> > > index, but the documents are in different languages.  
> > > I'm thinking I must use a specific analyzer for each language. Should I  
> > > declare a mapping with a different type for each language and at index time  
> > > I specify that specific type?  
> > > Could this be done simpler? Thank you!

---

<div class="post-metadata">

**Author:** ![bogdanionescu](https://avatars.discourse-cdn.com/v4/letter/b/7cd45c/32.png) [@bogdanionescu](https://discuss.elastic.co/u/bogdanionescu)\
**Post date:** [April 20, 2012, 7:50am UTC](https://discuss.elastic.co/t/index-with-documents-in-multiple-languages/7398/5 "2012-04-20T07:50:27Z")

</div>

I think I got it. Thank you:)

vineri, 20 aprilie 2012, 09:59:36 UTC+3, Raaadu a scris:

> You are right, and that is the feature I want to use. But I'll have  
> documents on all the languages and I'm asking if maybe there is another way  
> to to this beside defining a type for each document in a different language.  
> So dynamic mappings seem a cool feature, but I was wondering if I can vary  
> the language using a field value or I should vary a special field name in  
> order to dynamic map that document to a certain analyser
> 
> joi, 19 aprilie 2012, 20:54:46 UTC+3, Igor Motov a scris:
> 
> > You can specify analyzer name in a field:  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/analyzer-field.html)
> > 
> > On Thursday, April 19, 2012 11:51:15 AM UTC-4, Raaadu wrote:
> > 
> > > I'm looking at dynamic\_templates feature. Can this be used to choose  
> > > specify a different analyzer based on a field value? Like a "language"  
> > > field in the document?
> > > 
> > > joi, 19 aprilie 2012, 16:01:54 UTC+3, Raaadu a scris:
> > > 
> > > > Hello. I would like to index some documents, keep them in the same  
> > > > index, but the documents are in different languages.  
> > > > I'm thinking I must use a specific analyzer for each language. Should I  
> > > > declare a mapping with a different type for each language and at index time  
> > > > I specify that specific type?  
> > > > Could this be done simpler? Thank you!

---

<div class="post-metadata">

**Author:** ![Sapana\_Patel](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@Sapana\_Patel](https://discuss.elastic.co/u/Sapana_Patel)\
**Post date:** [January 25, 2013, 5:36am UTC](https://discuss.elastic.co/t/index-with-documents-in-multiple-languages/7398/6 "2013-01-25T05:36:02Z")

</div>

Hi Raaadu,

Can you please tell me how you archive that?  
I have same requirement for multiple languages.  
I want to store Product data and in that Product name & description can be  
in any language and other information are in english  
Can you please explain with example?

Thanks

On Friday, April 20, 2012 1:20:27 PM UTC+5:30, Raaadu wrote:

> I think I got it. Thank you:)

---

<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, 2:54am UTC](https://discuss.elastic.co/t/index-with-documents-in-multiple-languages/7398/7 "2017-07-06T02:54:40Z")

</div>


