# Bool query with a must and 2 match queries

**URL:** <https://discuss.elastic.co/t/bool-query-with-a-must-and-2-match-queries/237108>\
**Category:** Elasticsearch\
**Created:** [June 15, 2020, 9:56am UTC](https://discuss.elastic.co/t/bool-query-with-a-must-and-2-match-queries/237108 "2020-06-15T09:56:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hcraes](https://avatars.discourse-cdn.com/v4/letter/h/90ced4/32.png) [@hcraes](https://discuss.elastic.co/u/hcraes)\
**Post date:** [June 15, 2020, 9:56am UTC](https://discuss.elastic.co/t/bool-query-with-a-must-and-2-match-queries/237108/1 "2020-06-15T09:56:43Z")

</div>

Hello,

I recently started learning Elasticsearh and I have (probably) one noobie question. I have a field "name" & "surname". Both fields can have multiple words. Let's say I have a user with a name "Test Test2" and a surname "Test3" in the index. If I run query below I get 0 result. Any idea why? As you can see I simply want to run name="Test Test2" AND surname = "Test3" query but it's not working as expected.

Query:

```auto
    "query": {
      "bool": {
        "must": [
          {
            "match": {
              "name": {
                "query": "Test Test2",
                "operator": "and",
                "fuzziness": "auto",
              }
            }
          },
           {
            "match": {
              "surname": {
                "query": "Test3",
                "operator": "and",
                "fuzziness": "auto",
              }
            }
          }
        ],
      }
    }

```

mapping:

```auto
{
    "person": {
        "mappings": {
            "properties": {
			
                ...
				
                "name": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                },
                "surname": {
                    "type": "text",
                    "fields": {
                        "keyword": {
                            "type": "keyword",
                            "ignore_above": 256
                        }
                    }
                }
            }
        }
    }
}

```

settings

```auto
    {
    "person": {
        "settings": {
            "index": {
                "creation_date": "**",
                "number_of_shards": "1",
                "number_of_replicas": "1",
                " **": "**",
                "version": {
                    "created": "**"
                },
                "provided_name": "person"
            }
        }
    }
}

```

---

<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 13, 2020, 9:56am UTC](https://discuss.elastic.co/t/bool-query-with-a-must-and-2-match-queries/237108/2 "2020-07-13T09:56:44Z")

</div>

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