# How to filter with a query with scoring as an "AND" instead of an "OR"?

**URL:** <https://discuss.elastic.co/t/how-to-filter-with-a-query-with-scoring-as-an-and-instead-of-an-or/87192>\
**Category:** Elasticsearch\
**Created:** [May 26, 2017, 1:21am UTC](https://discuss.elastic.co/t/how-to-filter-with-a-query-with-scoring-as-an-and-instead-of-an-or/87192 "2017-05-26T01:21:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrick99e99](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patrick99e99/32/609_2.png) [@patrick99e99](https://discuss.elastic.co/u/patrick99e99)\
**Post date:** [May 26, 2017, 1:21am UTC](https://discuss.elastic.co/t/how-to-filter-with-a-query-with-scoring-as-an-and-instead-of-an-or/87192/1 "2017-05-26T01:21:01Z")

</div>

I am trying to search for documents that have a level of "series", and a full\_name of "awesome name", and filter by  
description of "lol". It seems that this query actually performs an OR, so it in addition to returning the records I expect, it also is returning documents that have a description "lol" but don't have "awesome name" or "series"...

I was under the impression that the solution to this problem was to add to the top level bool object "minimum\_number\_should\_match" with the value of 2, to turn the OR into an AND... However when I try that then I get no results back... Can anyone explain what I am doing wrong and how to properly do this?

Here is a _simplified_ version of the query I am using:

```
query: {
  bool: {
    should: [
      {
        bool: {
          must: [
            { match: { level: 'series' } },
            { bool:
              { should: [
                  {
                    match_phrase: {
                      full_name: {
                        query: 'awesome name',
                        boost: 3
                      }
                    }
                  }
                ]
              }
            }
          ]
        }
      }
  	],
	filter: {
		bool: {
			must: [
				{
					match: {
						filter: {
							'description': 'lol',
						}
					}
				}
			]
		}
	}
  }
}
```

---

<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 23, 2017, 1:21am UTC](https://discuss.elastic.co/t/how-to-filter-with-a-query-with-scoring-as-an-and-instead-of-an-or/87192/2 "2017-06-23T01:21:41Z")

</div>

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