# Multi text search in same field

**URL:** <https://discuss.elastic.co/t/multi-text-search-in-same-field/70685>\
**Category:** Elasticsearch\
**Created:** [January 5, 2017, 1:47pm UTC](https://discuss.elastic.co/t/multi-text-search-in-same-field/70685 "2017-01-05T13:47:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thanigaivelan19](https://avatars.discourse-cdn.com/v4/letter/t/90ced4/32.png) [@thanigaivelan19](https://discuss.elastic.co/u/thanigaivelan19)\
**Post date:** [January 5, 2017, 1:47pm UTC](https://discuss.elastic.co/t/multi-text-search-in-same-field/70685/1 "2017-01-05T13:47:24Z")

</div>

Hi,

How can we search multi text content in same field.

for example i have language field, i want to fetch multiple languages data like english , tamil, hindi

below is my code version 5.1.1

{  
"query": {  
"bool": {  
"must": {  
"term": {  
"parent\_cat": "6"  
}  
},  
"should": [  
{  
"term": {  
"lang": "T"  
}  
},  
{  
"term": {  
"lang": "en"  
}  
}  
],  
"must\_not": {  
"term": {  
"feed\_url\_status": "0"  
}  
}  
}  
}  
}

same process i had done this in version 2.1.1 , it is working fine. below is the code of it.

{  
"query": {  
"filtered": {  
"query": {  
"query\_string": {  
"query": "6",  
"fields": [  
"parent\_cat"  
]  
}  
},  
"filter": {  
"bool": {  
"should": [  
{  
"term": {  
"lang": "T"  
}  
},  
{  
"term": {  
"lang": "en"  
}  
}  
],  
"must\_not": {  
"term": {  
"feed\_url\_status": "0"  
}  
}  
}  
}  
}  
}  
}

Thanks

Thanigaivelan

---

<div class="post-metadata">

**Author:** ![mikemccand](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mikemccand](https://discuss.elastic.co/u/mikemccand)\
**Post date:** [January 5, 2017, 6:39pm UTC](https://discuss.elastic.co/t/multi-text-search-in-same-field/70685/2 "2017-01-05T18:39:20Z")

</div>

As of ES 5.x you can now add a `filter` clause to a `bool` query: [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html)

So to migrate your 2.1.1 query, you should make a `filter` clause that is another `bool` containing your `should` language terms.

Mike McCandless

---

<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:** [February 2, 2017, 6:39pm UTC](https://discuss.elastic.co/t/multi-text-search-in-same-field/70685/3 "2017-02-02T18:39:32Z")

</div>

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