Reputation: 3207
The following query is not working when "metadata.name" has "-" in the text like "demo-application-child3" . But if I remove "-" and make the query to "demoapplicationchild3". It works. The same with other field metadata.version. I've the data for both demoapplicationchild3 and demo-application-child3. suggestions please.
{
"query": {
"bool": {
"filter": [
{"term": { "metadata.name": "demo-application-child3" }},
{"term": { "metadata.version": "00.00.100" }}]
}
}
}
Upvotes: 0
Views: 844
Reputation: 32376
term queries are not analyzed see the official doc which clearly mention this
Returns documents that contain an exact term in a provided field.
Which clearly means that index time you are using some custom analyzer which is removing -
and joining the tokens ie for demo-application-child3
your custom analyzer would be generating demoapplicationchild3
token, which you can easily confirm using the Analyze api.
If you want to get result either change term
query to match
query or use the .keyword
suffix with your field if mappping is generated dynamically or create another field which is of type keyword which uses no-op analyzer.
Upvotes: 1