# Redundant should block or query\_string in query?

**URL:** <https://discuss.elastic.co/t/redundant-should-block-or-query-string-in-query/270602>\
**Category:** Elasticsearch\
**Created:** [April 19, 2021, 3:18pm UTC](https://discuss.elastic.co/t/redundant-should-block-or-query-string-in-query/270602 "2021-04-19T15:18:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [April 19, 2021, 3:18pm UTC](https://discuss.elastic.co/t/redundant-should-block-or-query-string-in-query/270602/1 "2021-04-19T15:18:32Z")

</div>

hey there,  
I can get the same result using two different approach for a specific query.  
The first one uses several `should terms`

```
"should": [
            {
              "terms": {
                   "fieldname": ["value1"]
               }
              },
               ...
               ...
               ... 
               {
               "terms": {
                   "fieldname": ["valueX"]
               }
              }
            ],
             "minimum_should_match": "80%"

```

while the second one will use the block:

```
{
      "query_string" : {
         "default_field" : "fieldname",
         "query" : "value1 OR value2 ......OR valueX",
         "minimum_should_match": "80%"
         }
 }

```

is there any suggestion to use one of them and to avoid any load or to increase speed?  
I don't know exactly how `should` directive works so I don't if it will query my index for every block or just one time.  
Currently, the first scenario is in place and queries are taking more or less 500ms. Achieving a time reduction even just 100ms could be important but I have not a chance to reproduce the same load in the second scenario so I have to start from the theory.

---

<div class="post-metadata">

**Author:** ![rschirin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rschirin/32/45283_2.png) [@rschirin](https://discuss.elastic.co/u/rschirin)\
**Post date:** [May 1, 2021, 5:23pm UTC](https://discuss.elastic.co/t/redundant-should-block-or-query-string-in-query/270602/2 "2021-05-01T17:23:04Z")

</div>

Is there anyone that can try to address me?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [May 10, 2021, 9:27am UTC](https://discuss.elastic.co/t/redundant-should-block-or-query-string-in-query/270602/3 "2021-05-10T09:27:56Z")

</div>

Internally those will likely be rewritten to similar queries, so I would use the one I feel more comfortable with. You can use the `explain` field to compare the two queries with each other.

Hope that helps!

---

<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:** [June 7, 2021, 9:28am UTC](https://discuss.elastic.co/t/redundant-should-block-or-query-string-in-query/270602/4 "2021-06-07T09:28:48Z")

</div>

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