# Download entire databag?

**URL:** <https://discourse.chef.io/t/download-entire-databag/3729>\
**Category:** Chef Infra (archive)\
**Created:** [March 12, 2013, 10:13pm UTC](https://discourse.chef.io/t/download-entire-databag/3729 "2013-03-12T22:13:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesse\_Campbell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jesse_campbell/32/251_2.png) [@Jesse\_Campbell](https://discourse.chef.io/u/Jesse_Campbell)\
**Post date:** [March 12, 2013, 10:13pm UTC](https://discourse.chef.io/t/download-entire-databag/3729/1 "2013-03-12T22:13:26Z")

</div>

hello!

i am using data bags in such a way that an “admin” server creates about  
3500 data bag items in a specific, then on each chef run verifies the  
contents and deletes or adds missing or extra items.

i realize this is not the same way others would do it, but it is how i do  
it.

what i’m wondering:

is there a way to download the entire data bag, rather than fetching each  
item one by one? it works out to 3500 round trips, which adds up to a very  
long chef run…

thanks!  
-jesse

---

<div class="post-metadata">

**Author:** ![Brian\_Akins](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/brian_akins/32/298_2.png) [@Brian\_Akins](https://discourse.chef.io/u/Brian_Akins)\
**Post date:** [March 12, 2013, 10:36pm UTC](https://discourse.chef.io/t/download-entire-databag/3729/2 "2013-03-12T22:36:22Z")

</div>

You can use search. search(:mydatabag, “_:_”)

[http://docs.opscode.com/essentials\_data\_bags\_use\_search.html](http://docs.opscode.com/essentials_data_bags_use_search.html)

---

<div class="post-metadata">

**Author:** ![Jesse\_Campbell](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jesse_campbell/32/251_2.png) [@Jesse\_Campbell](https://discourse.chef.io/u/Jesse_Campbell)\
**Post date:** [March 12, 2013, 10:41pm UTC](https://discourse.chef.io/t/download-entire-databag/3729/3 "2013-03-12T22:41:21Z")

</div>

Hmm. This could work. Back in the once upon a time that failed because  
there was one big data bag item instead of 3500 tiny ones, and no matter  
how the config was changed, solr refused to index it.

I'd prefer a direct call instead of a search, but this could work.

Could even use partial search when a node needs one attribute from each of  
1800 of those. Hmm 🙂  
On Mar 12, 2013 6:36 PM, "Brian Akins" [brian@akins.org](mailto:brian@akins.org) wrote:

> You can use search. search(:mydatabag, "_:_")
> 
> [http://docs.opscode.com/essentials\_data\_bags\_use\_search.html](http://docs.opscode.com/essentials_data_bags_use_search.html)
