Search for exact field in an array

Elasticsearch version: 7.1.1

Hi, I try a lot but could not found any solution
in my index, I have a field which is containing strings.

so, for example, I have two documents containing different values in locations array.

Document-1:

"doc" : {
                "locations" : [
                  "Cloppenburg",
                  "Berlin"
                ]
              }

Document-2:

        "doc" : {
                "locations" : [
                  "Landkreis Cloppenburg",
                  "Berlin"
                ]
              }

a user requests a search for a term Cloppenburg
and I want to return only those documents which contain term Cloppenburg
and not Landkreis Cloppenburg.
the results should contain only Document-1.

I am using the following query and getting both documents back.
can someone please help me out in this.

    GET /my_index/_search
     {
        "query": {
            "bool": {
                "must": [
                    {
                        "match": {
                            "doc.locations": {
                                "query": "cloppenburg",
                                "operator": "and"
                            }
                        }
                    }
                ]
            }
        }
    }

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