# How to use fields for searching through translations?

**URL:** <https://discuss.elastic.co/t/how-to-use-fields-for-searching-through-translations/371239>\
**Category:** Elasticsearch\
**Created:** [November 29, 2024, 2:32pm UTC](https://discuss.elastic.co/t/how-to-use-fields-for-searching-through-translations/371239 "2024-11-29T14:32:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yoann\_Buzenet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yoann_buzenet/32/133522_2.png) [@Yoann\_Buzenet](https://discuss.elastic.co/u/Yoann_Buzenet)\
**Post date:** [November 29, 2024, 2:32pm UTC](https://discuss.elastic.co/t/how-to-use-fields-for-searching-through-translations/371239/1 "2024-11-29T14:32:29Z")

</div>

Hello,

I have text fields in my database that are translated. I would like to use an analyzer adapted for each language to get the best results.

I thought about using `fields` like this:

```auto
PUT my-index-000001
{
  "mappings": {
    "properties": {
      "text": { 
        "type": "text",
        "fields": {
          "english": { 
            "type": "text",
            "analyzer": "english"
          },
          "french": { 
            "type": "text",
            "analyzer": "french"
          }       
        }
      }
    }
  }
}

```

This way, if an user enters an english or french sentence, I can look up in both fields and will remove the relevant stop words etc.

But I don't understand which kind of payload I should send to create data in that index ? I would think it awaits an object with both french and english key to store each translation, but I receive an error - it awaits text it seems.

Would you please give me an example?

---

<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:** [November 29, 2024, 4:57pm UTC](https://discuss.elastic.co/t/how-to-use-fields-for-searching-through-translations/371239/2 "2024-11-29T16:57:15Z")

</div>

Bonjour Yoann

It would be easier if you could share the command you sent and the exact answer.

I would assume something like:

```auto
POST my-index-000001/_doc
{
  "text": "voici un texte"
}

```

---

<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:** [December 27, 2024, 4:57pm UTC](https://discuss.elastic.co/t/how-to-use-fields-for-searching-through-translations/371239/3 "2024-12-27T16:57:19Z")

</div>

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