I can't use setSource(String) this method with ES 5.6

when i upgrade my ES from 1.7 to ES 5.6, i can't use this setSource(String) method anymore, please tell me . what kind of method i can use it in order to make my service alive again.
. image
this is a old method i can't use. what is it replaced by?

you cannot set the source directly anymore, you need to use a SearchSourceBuilder instead. That will give you a lot of convenience methods for building your search request (like adding queries via QueryBuilder) etc... Creating the SearchSourceBuilder from a String (e.g. Json) directly would require some sort of parsing, which can be done but should probably be avoided since it requires you to have access to a few internal registries to do the parsing. Hope this helps a bit.

1 Like

thanx a lot, i fixed this problem already.:grin::grin:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.