I want to match "command. Id:", exactly in 'Message'.
I have tried this,
{
"query": {
"match_phrase": {
"Message": {
"query": "command. id:",
"slop": 0
}
}
}
}
However, this matches "Command ID" and "command ID" as well. How to achieve matching the exact phrase "command. id:". Do I need to create a custom analzyer?
Would it be possible for you to show your mappings? If not take a look yourself and see how your Message field is mapped. If it isn't mapped as a keyword or not_analyzed then it is being run through an analyzer. By default text is run through the standard analyzer. Check out this link which explains why a term query, or match_phrase in your case, can fail to match what you intended. Hope this helps!
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.