# How query\_string work underlying

**URL:** <https://discuss.elastic.co/t/how-query-string-work-underlying/320807>\
**Category:** Elasticsearch\
**Tags:** eql-elastic-query-language\
**Created:** [December 8, 2022, 3:44pm UTC](https://discuss.elastic.co/t/how-query-string-work-underlying/320807 "2022-12-08T15:44:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hieple18](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hieple18/32/114415_2.png) [@hieple18](https://discuss.elastic.co/u/hieple18)\
**Post date:** [December 8, 2022, 3:44pm UTC](https://discuss.elastic.co/t/how-query-string-work-underlying/320807/1 "2022-12-08T15:44:56Z")

</div>

I am trying to figure out how query\_string work underlying. cause I want to compare performance of using query\_string with other solution  
I tried to deep dive into source code but no answer  
example I have a query

```auto
{
  "query_string": {
      "query": "(men OR man) tee size (x OR xs)"
  }
}

```

is elastic generate above query into 4 query as?

```auto
{
  "match": {
      "query": "men tee size x"
  }
},
{
  "match": {
      "query": "man tee size x"
  }
},
{
  "match": {
      "query": "men tee size xs"
  }
},
{
  "match": {
      "query": "man tee size xs"
  }
}

```

Please help me. Thank you

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [December 8, 2022, 6:01pm UTC](https://discuss.elastic.co/t/how-query-string-work-underlying/320807/2 "2022-12-08T18:01:52Z")

</div>

Hi @hieple18

Try use [Profile API.](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-profile.html#search-profile)

---

<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:** [January 5, 2023, 6:01pm UTC](https://discuss.elastic.co/t/how-query-string-work-underlying/320807/3 "2023-01-05T18:01:58Z")

</div>

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