# Search template based on list

**URL:** https://discuss.elastic.co/t/search-template-based-on-list/347852
**Category:** Elasticsearch
**Created:** [November 23, 2023, 12:37pm UTC](https://discuss.elastic.co/t/search-template-based-on-list/347852 "2023-11-23T12:37:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![pszemesy](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@pszemesy](https://discuss.elastic.co/u/pszemesy)
#### Post date: [November 23, 2023, 12:37pm UTC](https://discuss.elastic.co/t/search-template-based-on-list/347852/1 "2023-11-23T12:37:30Z")

</div>

Hi All,

I have an index (contains translations) with the following mappings:

```auto
document_name: keyword,
...
EN: {
  content: text,
  stored_by: keyword,
  stored_at: date,
  ...
}
<<lang code>>: {
  content: text,
  stored_by: keyword,
  stored_at: date,
  ...
} 

```

Till now the 3rd party application has searched on the following way:

```auto
GET translation-*/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match" : {
            "EN.content": {
              "query": <<query text>>,
              ...
            }
          }
        }
      ],
      "should": [
        {
          "exists": {
            "field": <<language code 1>>
          }
        },
        {
          "exists": {
            "field": <<language code 2>>
          }
        },
        {
          ...
        },
        {
          "exists": {
            "field": <<language code n>>
          }
        }
      ],
      "minimum_should_match": 1
    }
  },
  "_source": [
    "document_name",
    <<language code 1>>,
    <<language code 2>>,
    ...,
   <<language code n>>
  ]
}

```

So I would like to create a search template where the parameters are the following:

- query text
- list of language codes

Are there any way to create something like that? Thanks

---

<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 21, 2023, 12:37pm UTC](https://discuss.elastic.co/t/search-template-based-on-list/347852/2 "2023-12-21T12:37:38Z")

</div>

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