# Knife search edge cases

**URL:** <https://discourse.chef.io/t/knife-search-edge-cases/5491>\
**Category:** Chef Infra (archive)\
**Created:** [June 6, 2014, 5:44pm UTC](https://discourse.chef.io/t/knife-search-edge-cases/5491 "2014-06-06T17:44:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeff\_Blaine](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeff_blaine/32/19_2.png) [@Jeff\_Blaine](https://discourse.chef.io/u/Jeff_Blaine)\
**Post date:** [June 6, 2014, 5:44pm UTC](https://discourse.chef.io/t/knife-search-edge-cases/5491/1 "2014-06-06T17:44:41Z")

</div>

I’m routinely frustrated by knife search queries. Is there a more  
detailed guide that what’s on [docs.opscode.com](http://docs.opscode.com) or does anyone have any  
general tips from past experience?

Hopefully without diminishing the general query above and then only  
getting explicit replies to these questions… how do I escape a ':'  
that I want to match against in my query? how do I escape a ’ '?

---

<div class="post-metadata">

**Author:** ![zts](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/zts/32/111_2.png) [@zts](https://discourse.chef.io/u/zts)\
**Post date:** [June 6, 2014, 6:02pm UTC](https://discourse.chef.io/t/knife-search-edge-cases/5491/2 "2014-06-06T18:02:01Z")

</div>

On Fri, Jun 6, 2014 at 6:44 PM, Jeff Blaine [jblaine@kickflop.net](mailto:jblaine@kickflop.net) wrote:

> I'm routinely frustrated by knife search queries. Is there a more  
> detailed guide that what's on [docs.opscode.com](http://docs.opscode.com) or does anyone have any  
> general tips from past experience?

Which docs are you looking at? I'd say  
[About Search](http://docs.opscode.com/essentials_search.html) is pretty detailed, and a  
vast improvement on the search docs I recall from the old wiki. That said,  
nothing's perfect and I'm sure the Chef folks would appreciate feedback on  
what's missing.

Hopefully without diminishing the general query above and then only

> getting explicit replies to these questions... how do I escape a ':'  
> that I want to match against in my query? how do I escape a ' '?

Any "special" character can be escaped with a backslash, and colon is  
included in that set (see  
[About Search](http://docs.opscode.com/essentials_search.html#special-characters) ). You  
don't need to escape spaces.

Most of the things that I thought were under-documented in the past (eg,  
nested field syntax, gotchas searching for run list items) seem to be  
thoroughly covered in the current docs, so I'm coming up short on other  
hints and tips. If you were expanding the docs, are there any particular  
headlines or topics you'd like to see filled out?

Zac

---

<div class="post-metadata">

**Author:** ![James\_Scott](https://avatars.discourse-cdn.com/v4/letter/j/f14d63/32.png) [@James\_Scott](https://discourse.chef.io/u/James_Scott)\
**Post date:** [June 6, 2014, 8:10pm UTC](https://discourse.chef.io/t/knife-search-edge-cases/5491/3 "2014-06-06T20:10:53Z")

</div>

This probably helps too:

> <https://github.com/chef-boneyard/chef-web-docs-2016/commit/ae51ad2e2fe62b4fc63d685e1a5a3725b88d3a91>

Gets more information about the query patterns into the actual  
knife\_search.html page.

On Fri, Jun 6, 2014 at 11:02 AM, Zac Stevens [zts@cryptocracy.com](mailto:zts@cryptocracy.com) wrote:

> On Fri, Jun 6, 2014 at 6:44 PM, Jeff Blaine [jblaine@kickflop.net](mailto:jblaine@kickflop.net) wrote:
> 
> > I'm routinely frustrated by knife search queries. Is there a more  
> > detailed guide that what's on [docs.opscode.com](http://docs.opscode.com) or does anyone have any  
> > general tips from past experience?
> 
> Which docs are you looking at? I'd say  
> [About Search](http://docs.opscode.com/essentials_search.html) is pretty detailed, and a  
> vast improvement on the search docs I recall from the old wiki. That said,  
> nothing's perfect and I'm sure the Chef folks would appreciate feedback on  
> what's missing.
> 
> Hopefully without diminishing the general query above and then only
> 
> > getting explicit replies to these questions... how do I escape a ':'  
> > that I want to match against in my query? how do I escape a ' '?
> 
> Any "special" character can be escaped with a backslash, and colon is  
> included in that set (see  
> [About Search](http://docs.opscode.com/essentials_search.html#special-characters) ). You  
> don't need to escape spaces.
> 
> Most of the things that I thought were under-documented in the past (eg,  
> nested field syntax, gotchas searching for run list items) seem to be  
> thoroughly covered in the current docs, so I'm coming up short on other  
> hints and tips. If you were expanding the docs, are there any particular  
> headlines or topics you'd like to see filled out?
> 
> Zac

---

<div class="post-metadata">

**Author:** ![Jeff\_Blaine](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jeff_blaine/32/19_2.png) [@Jeff\_Blaine](https://discourse.chef.io/u/Jeff_Blaine)\
**Post date:** [June 6, 2014, 8:33pm UTC](https://discourse.chef.io/t/knife-search-edge-cases/5491/4 "2014-06-06T20:33:43Z")

</div>

On 6/6/2014 4:10 PM, James Scott wrote:

> This probably helps too:
> 
> [add context to knife\_search.html · chef-boneyard/chef-web-docs-2016@ae51ad2 · GitHub](https://github.com/opscode/chef-docs/commit/ae51ad2e2fe62b4fc63d685e1a5a3725b88d3a91)
> 
> Gets more information about the query patterns into the actual  
> knife\_search.html page.

Yes. That! I wasn't hitting that with google. Thanks James and Zac.

Digging back through my bash history from earlier today, here's a  
problem case:

% knife search 'lastrun\_runtimes\_end:2014-06-06 11:33\*' -i | grep eleven  
eleven  
% knife node show eleven -a lastrun.runtimes.end  
eleven:  
lastrun.runtimes.end: 2014-06-06 16:01:05 -0400

o\_O  
Jeff

> On Fri, Jun 6, 2014 at 11:02 AM, Zac Stevens \<[zts@cryptocracy.com](mailto:zts@cryptocracy.com)  
> [mailto:zts@cryptocracy.com](mailto:zts@cryptocracy.com)\> wrote:
> 
> ```
> On Fri, Jun 6, 2014 at 6:44 PM, Jeff Blaine <jblaine@kickflop.net
> <mailto:jblaine@kickflop.net>> wrote:
> 
> I'm routinely frustrated by knife search queries. Is there a more
> detailed guide that what's on docs.opscode.com
> <http://docs.opscode.com> or does anyone have any
> general tips from past experience?
> 
> Which docs are you looking at? I'd say
> http://docs.opscode.com/essentials_search.html is pretty detailed,
> and a vast improvement on the search docs I recall from the old
> wiki. That said, nothing's perfect and I'm sure the Chef folks
> would appreciate feedback on what's missing.
> 
> Hopefully without diminishing the general query above and then only
> getting explicit replies to these questions... how do I escape a ':'
> that I want to match against in my query? how do I escape a ' '?
> 
> Any "special" character can be escaped with a backslash, and colon
> is included in that set (see
> http://docs.opscode.com/essentials_search.html#special-characters ).
> You don't need to escape spaces.
> 
> Most of the things that I thought were under-documented in the past
> (eg, nested field syntax, gotchas searching for run list items) seem
> to be thoroughly covered in the current docs, so I'm coming up short
> on other hints and tips. If you were expanding the docs, are there
> any particular headlines or topics you'd like to see filled out?
> 
> Zac
> 
> ```
