Elastic 8 not search with hyphen

I have documents with id fields
{id:domain-837}{id:domain-838}
these are automatically stored using mapping with data type keyword.

"id": {
"type": "text",
"fields": {
"keyword": {
"ignore_above": 256,
"type": "keyword"
}
}
},

Still when I search it using
MatchQuery,TermQuery I cannot get correct results.

{
    "query": {
        "match_phrase": {
         "id": "domain-838"
        }
    }
}
{
  "query": {
    "terms": {
      "_id": [
        "domain-837"
      ]
    }
  }
}

There is a problem with hypen.
Has anyone solved this already can someone share how to define anyalyzer or what data type to use kindly share here

Try using id.keyword instead, as your id field is a text and will be analysed where as the .keyword will be "raw".

does not work with keyword it returns irrelevant result tried search search with term{"field.keyword":value}

Did you try the following (assuming domain-837 is an existing value)?

{
  "query": {
    "term": {
      "id.keyword": {
        "value": "domain-837"
      }
    }
  }
}

What does the document you would expect to match look like?

one more observation I am searching for elastic document UUIDS and I am searching for the text like pG4h5YYBbrFFY-P9s60F
tried like what u shared using term but no use.
I also need partial search say if I search only pG4h5YYBbrFFY or P9s60F