Great question. I've seen this happen before as well, but I never really understood what was happening, so now I had a real reason to look it up .
When you put something like that in the query bar in Kibana, it passes the contents through to Elasticsearch as the query
parameter in a query_sting
query. Here's a quick example from the relevant part of the request sent to Elasticsearch, when using clientip:"186.187.11.181"
in the query bar:
"query": {
"bool": {
"must": [{
"query_string": {
"query": "clientip:\"186.187.11.181\"",
"analyze_wildcard": true
}
}, {
"range": {
"@timestamp": {
"gte": 1467240398565,
"lte": 1467241298565,
"format": "epoch_millis"
}
}
}],
"must_not": []
}
},
Drop the quotes and the query becomes:
"query": {
"bool": {
"must": [{
"query_string": {
"query": "clientip:186.187.11.181",
"analyze_wildcard": true
}
}, {
"range": {
"@timestamp": {
"gte": 1467240403856,
"lte": 1467241303857,
"format": "epoch_millis"
}
}
}],
"must_not": []
}
},
I'm still not entirely sure how the two queries differ, but perhaps it has to fo with the "analyze_wildcard": true
specified. According to the docs, "by setting analyze_wildcard to true, an attempt will be made to analyze wildcarded words before searching the term list for matching terms." So, it's possible that the the analyzer is changing the query, and thus affecting the results.
That's not really an answer, I know, but that's as far as I've been able to get with it. In the query string syntax section of the docs, it links back to itself. I'd recommend asking in the Elasticsearch section of the forums, someone over there likely has a better understanding of the query syntax.