How to search exact string in array of string values

This is my index


{
  "mappings": {
    "page": {
      "properties": {
        "company-product-skus": {
          "type": "text",
          "include_in_all": false,
          "analyzer": "keyword",
          "index": "not_analyzed"
        }
      }
    }
  }
}

This is data i have

    ...
"company-product-skus": [
  "5-pseudo",
  "4-test"
],
    ...

How should i query to fetch exact matched documents only ?

use case:
query: 5-pseudo - return document
query: 5-pseu - does not return

Thanks in advance

Hey,

you can also just set the type to `keyword, see https://www.elastic.co/guide/en/elasticsearch/reference/7.2/keyword.html

then running a match query for 5-pseudo should only return an exact match.
If this does not work, please share a full reproducible example.

Thanks!

--Alex

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