elasticsearch/elasticsearch — pull request #2367 by synhershko (2012-10-30 08:47:36+00:00)
Title: Add getters to SearchSourceBuilder, to allow for encapsulation

At this point, there is no way to reuse existing behavior if you want to add custom behavior to it. In our case, we wanted to issue a search request but get processed data (vs getting actual search results). We found ourselves copying EVERYTHING.

This proposed changed will allow us to encapsulate and resuse at least some of the behavior. We will still need to duplicate quite a lot of code because of the way RequestBuilder and SourceBuilder classes are designed. If this can be opened for discussion, we would be happy to assist with that as well.