Exact field value match

I’m trying to achieve Exact field value match,
E.g.
“content” : “how are you” : find all the documents which exactly have the value “how are you” inside the entire field “content”
What we tried in elasticsearch:
{
"query": {
"bool": {
"must": [
{
"script": {
"script": {
"inline": "doc['content.keyword'].getValue().length() == 11 ",
"lang": "painless"
}
}
},
{
"match_phrase": {
"testfield": "how are you"
}
}]
}
}
}

Problem observed:
Scripting is slow and this will require per document field data and test fields are not optimized for such operations. So we had to either use via keyword (we want full text) or enable fielddata (this will use more memory).

Any guidance would be helpful here.

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