Bool query with a must and 2 match queries

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:

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

mapping:

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

settings

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

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