knife-search1
The man page for the knife search subcommand. search indexes allow queries to be made for any type of data that is indexed by the chef server, including data bags (and data bag items), environments, nodes, and roles. a defined query syntax is used to support search patterns like exact, wildcard, range, and fuzzy. a search is a full-text query that can be done from several locations, including from within a recipe, by using the search subcommand in knife, the search method in the recipe dsl, and by using the /search or /search/index endpoints in the chef server api. the search engine is based on apache solr and is run from the chef server. the knife search subcommand is used run a search query for information that is indexed on a chef server. syntax this subcommand has the following syntax: where index is one of client, environment, node, role, or the name of a data bag and search_query is the search query syntax for the query that will be executed. index is implied if omitted, and will default to node. for example: will return something similar to: and is the same search as: if the search_query does not contain a colon character (:), then the default query pattern is tags:*#{@query}* or roles:*#{@query}* or fqdn:*#{@query}* or addresses:*#{@query}*, which means the following two search queries are effectively the same: or: options this sub-command has the following options: examples to search for the ids of all nodes running on the amazon ec2 platform, enter: to return something like: to search for the instance type (flavor) of all nodes running on the amazon ec2 platform, enter: to return something like: to search for all nodes running ubuntu, enter: to search for all nodes running centos in the production environment, enter: to find a nested attribute, use a pattern similar to the following: to build a search query to use more than one attribute, use an underscore (_) to separate each attribute. for example, the following query will search for all nodes running a specific version of ruby: to build a search query that can find a nested attribute: to test a search query that will be used in a knife ssh command: where the query in the previous example will search all servers that have the web role, but not on the server named web03.
Releases
4 releases since Debian 7 (Wheezy); the text changed 2 times.