[SOLVED] Values with a dash '-' can't be searched via knife


CHEF version : 12.19.36

I’m trying to do a search through a data bag for specific elements containing negative values.

For example, if I have a web app data bag item with the following values, in the data bag « webapps » :

name: ‘My whizzbang app’, 
status: -100, 

If I try to look for all webapps having a ‘-100’ status, I would use the lucene syntax as such :

knife search webapps ’status:\-100’

returns :

ERROR: knife search failed: invalid search query: 'status:\-100’

Any clue on the right syntax for this kind of search ? Thanks in advance.


you can search like this

knife search webapps ‘status:*-100’


Thanks Eddy, this works fine.