# Multi-String search not working as expeced

**URL:** <https://discuss.elastic.co/t/multi-string-search-not-working-as-expeced/240457>\
**Category:** Elasticsearch\
**Created:** [July 9, 2020, 6:35am UTC](https://discuss.elastic.co/t/multi-string-search-not-working-as-expeced/240457 "2020-07-09T06:35:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ksarkar](https://avatars.discourse-cdn.com/v4/letter/k/ee7513/32.png) [@ksarkar](https://discuss.elastic.co/u/ksarkar)\
**Post date:** [July 9, 2020, 6:35am UTC](https://discuss.elastic.co/t/multi-string-search-not-working-as-expeced/240457/1 "2020-07-09T06:35:29Z")

</div>

While executing following query,

```auto
GET /rm_inventory_details*/_search
{
    "query": {
      "query_string": {
        "default_field": "usage",
        "query": "(XYZ)"
      }
	}
}

```

Getting result.  
again

```auto
GET /rm_inventory_details*/_search
{
    "query": {
      "query_string": {
        "default_field": "usage",
        "query": "(ABC)"
      }
	}
}

```

Also getting result.

But while using following I am only getting second choice while expecting both the string either or.

```auto
GET /rm_inventory_details*/_search
{
    "query": {
      "query_string": {
        "default_field": "usage",
        "query": "(XYZ) OR (ABC)"
      }
	}
}

```

---

<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:** [July 9, 2020, 1:03pm UTC](https://discuss.elastic.co/t/multi-string-search-not-working-as-expeced/240457/2 "2020-07-09T13:03:51Z")

</div>

Why the parenthesis?  
Could you share all responses?

Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script is something anyone can copy and paste in Kibana dev console, click on the run button to reproduce your use case. It will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

---

<div class="post-metadata">

**Author:** ![ksarkar](https://avatars.discourse-cdn.com/v4/letter/k/ee7513/32.png) [@ksarkar](https://discuss.elastic.co/u/ksarkar)\
**Post date:** [July 9, 2020, 1:22pm UTC](https://discuss.elastic.co/t/multi-string-search-not-working-as-expeced/240457/3 "2020-07-09T13:22:14Z")

</div>

Hi,

Result is same even if I use parenthesis or not.  
It is taking second value not the first one but surely both values are present in index field "usage".  
I can see both if I use

```auto
"query": "XYZ"

```

or

```auto
"query": "ABC"

```

individually.

I would only like to know what wrong I am doing here.

by the way I am using 7.1.1.

Output is quite large to fit. If you still insist then I need to create a less numbered data ant try.

---

<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:** [July 9, 2020, 2:23pm UTC](https://discuss.elastic.co/t/multi-string-search-not-working-as-expeced/240457/4 "2020-07-09T14:23:22Z")

</div>

> [@ksarkar](#):
>
> If you still insist then I need to create a less numbered data ant try.

Would be great.

---

<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:** [August 6, 2020, 2:23pm UTC](https://discuss.elastic.co/t/multi-string-search-not-working-as-expeced/240457/5 "2020-08-06T14:23:24Z")

</div>

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