WARNING: Avoid using the term query for text fields.
By default, Elasticsearch changes the values of text fields as part of analysis. This can make finding exact matches for text field values difficult.
To search text field values, use the match query instead.
Text fields are analyzed (split for tokens, delete stop words, convert lower case... etc by default) to tokens before indexed but the phrase for term/terms query are not analyzed. The phrase must be exactly the same as the token after analysis. That's the reason why term/terms query doesn't hit the document.
Besides RabBit's suggestion to add keyword field, there are an option only to change the type itself from text to keyword just as:
"name": {
"type": "keyword"
}
. To change the mappings, you need delete and create the index again or re-index from the index to another index.
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.