Wrong results when {host.name} includes a minus (-) character
matthenning opened this issue · comments
Expected Behavior
If the host name contains a minus (-) character I only receive results for this host when querying elasticsearch like this:
fields.host_name={host.name}
hostname: `demo-host.local'
Current Behavior
I receive results for all fields.host_name
containing demo
or host.local
Possible Solution
Wrap the {host.name} in double quotes when translating to elasticsearch query
Steps to Reproduce (for bugs)
Compare the results of the lucene queries
fields.host_name:demo-host.local
and
fields.host_name:"demo-host.local"
Your Environment
- Module version (System - About): 1.0.0
- Icinga Web 2 version and modules (System - About): 2.5.3
- Icinga 2 version (
icinga2 --version
): 2.8.4 - Elasticsearch version (
curl http://localhost:9200
): 5.6 - Operating System and version: Debian 9.4
- Webserver, PHP versions: NGINX, PHP 7.0
see my response in the other duplicate issue here - #26
You'll want to change your mapping type on your index to "keyword" for the hostname, or try using the .keyword type in your query. - eg fields.host_name.keyword={host.name}
Duplicate of #26