Information Technology Reference
In-Depth Information
comment: Alice Jones
data_bag: users
gid: 0
home: /home/alice
id: alice
shell: /bin/bash
uid: 2000
The same search query variants we used in Chapter 12 for nodes also apply to data bags. The
query fields are just slightly different as they are no longer node attributes. For example, the
following query would return the items where the id is alice OR bob :
$ knife search users "id:alice OR id:bob"
2 items found
chef_type: data_bag_item
comment: Alice Jones
data_bag: users
gid: 0
home: /home/alice
id: alice
shell: /bin/bash
uid: 2000
chef_type: data_bag_item
comment: Bob Smith
data_bag: users
gid: 0
home: /home/bob
id: bob
shell: /bin/bash
uid: 2001
Just as we covered in Chapter 12 , search results can be filtered with the -a parameter. For ex-
ample, -a shell returns the value only for the users shell:
$ knife search users "*:*" -a shell
2 items found
data_bag_item_users_alice:
shell: /bin/bash
Search WWH ::




Custom Search