# How to do multiple text search in same field

**URL:** <https://discuss.elastic.co/t/how-to-do-multiple-text-search-in-same-field/45872>\
**Category:** Elasticsearch\
**Created:** [March 31, 2016, 5:18am UTC](https://discuss.elastic.co/t/how-to-do-multiple-text-search-in-same-field/45872 "2016-03-31T05:18:15Z")\
**Posts on this page:** 6\
**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:** [March 31, 2016, 5:18am UTC](https://discuss.elastic.co/t/how-to-do-multiple-text-search-in-same-field/45872/1 "2016-03-31T05:18:15Z")

</div>

Hi,

I want to do multiple text search in same field

for example in sub\_cat\_seo\_url field i want to get 'english-news' and 'business-news' filter by language and region

when i tried like below code it is not working

```
{
   "query":{
      "filtered":{
         "query":{
            "query_string":{
               "query":[
                  "english-news",
                  "business-news"
               ],
               "fields":[
                  "sub_cat_seo_url"
               ]
            }
         },
         "filter":{
            "bool":{
               "must":[
                  {
                     "term":{
                        "lang":"en"
                     }
                  },
                  {
                     "term":{
                        "region":"1"
                     }
                  }
               ]
            }
         }
      }
   }
}

```

For single text search it is working fine

```
{
   "query":{
      "filtered":{
         "query":{
            "query_string":{
               "query":"english-news",
               "fields":[
                  "sub_cat_seo_url"
               ]
            }
         },
         "filter":{
            "bool":{
               "must":[
                  {
                     "term":{
                        "lang":"en"
                     }
                  },
                  {
                     "term":{
                        "region":"1"
                     }
                  }
               ]
            }
         }
      }
   }
}

```

Please help what have to change in my code, to do multi text search in same field (or operation)

Thanks

Thanigaivelan

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [March 31, 2016, 8:36am UTC](https://discuss.elastic.co/t/how-to-do-multiple-text-search-in-same-field/45872/2 "2016-03-31T08:36:22Z")

</div>

Maybe try this:

```auto
{
   "query":{
      "filtered":{
        "query": {
          "bool": {
            "should": [
              {
                "query_string": {
                  "query": "english-news",
                  "fields": ["sub_cat_seo_url"]
                }
              },
              {
                "query_string": {
                  "query": "business-news",
                  "fields": ["sub_cat_seo_url"]
                }
              }
            ]
          }
        },
         "filter":{
            "bool":{
               "must":[
                  {
                     "term":{
                        "lang":"en"
                     }
                  },
                  {
                     "term":{
                        "region":"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:** [April 8, 2016, 5:28am UTC](https://discuss.elastic.co/t/how-to-do-multiple-text-search-in-same-field/45872/3 "2016-04-08T05:28:51Z")

</div>

> [@jpountz](#):
>
> {  
> "query":{  
> "filtered":{  
> "query":{  
> "bool":{  
> "should":[  
> {  
> "query\_string":{  
> "query":"english-news",  
> "fields":[  
> "sub\_cat\_seo\_url"  
> ]  
> }  
> },  
> {  
> "query\_string":{  
> "query":"business-news",  
> "fields":[  
> "sub\_cat\_seo\_url"  
> ]  
> }  
> }  
> ]  
> }  
> },  
> "filter":{  
> "bool":{  
> "must":[  
> {  
> "term":{  
> "lang":"en"  
> }  
> },  
> {  
> "term":{  
> "region":"1"  
> }  
> }  
> ]  
> }  
> }  
> }  
> }  
> }

it is not working, it fetch only second search (business-news) not fetching the (english-news).

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [April 8, 2016, 7:32am UTC](https://discuss.elastic.co/t/how-to-do-multiple-text-search-in-same-field/45872/4 "2016-04-08T07:32:49Z")

</div>

Then please provide a full recreation with example documents so that we can help you.

---

<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:** [April 8, 2016, 9:09am UTC](https://discuss.elastic.co/t/how-to-do-multiple-text-search-in-same-field/45872/5 "2016-04-08T09:09:08Z")

</div>

> [@thanigaivelan19](#):
>
> {  
> "query":{  
> "filtered":{  
> "query":{  
> "query\_string":{  
> "query":[  
> "english-news",  
> "business-news"  
> ],  
> "fields":[  
> "sub\_cat\_seo\_url"  
> ]  
> }  
> },  
> "filter":{  
> "bool":{  
> "must":[  
> {  
> "term":{  
> "lang":"en"  
> }  
> },  
> {  
> "term":{  
> "region":"1"  
> }  
> }  
> ]  
> }  
> }  
> }  
> }  
> }

[http://27378a470e566caadd54304da0d85849.us-east-1.aws.found.io:9200/episodes/episode/\_search?pretty=true&size=100&from=0](http://27378a470e566caadd54304da0d85849.us-east-1.aws.found.io:9200/episodes/episode/_search?pretty=true&size=100&from=0)

---

<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 5, 2017, 11:01pm UTC](https://discuss.elastic.co/t/how-to-do-multiple-text-search-in-same-field/45872/6 "2017-07-05T23:01:13Z")

</div>


