Icinga / icingaweb2-module-elasticsearch

This module will not be updated by Icinga anymore. Please don't attempt to use it.
GNU General Public License v2.0
29 stars 9 forks source link

Wrong results when {host.name} includes a minus (-) character #34

Closed matthenning closed 5 years ago

matthenning commented 6 years ago

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

MarcusCaepio commented 6 years ago

I can confirm this. My filter: image Result: image

jediblair commented 6 years ago

see my response in the other duplicate issue here - https://github.com/Icinga/icingaweb2-module-elasticsearch/issues/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}

lippserd commented 5 years ago

Duplicate of #26