I found in the doc that "All REST APIs accept a filter_path parameter that can be used to reduce the response returned by elasticsearch". But I can't find this parameters in SearchRequestBuilder like other parameters.How can i use this function in java?Thinks
when using the Java client API, you use either the node or the transport client which use another wire protocol. There is no REST client for Java and hence this option is not supported.
Note that Elasticsearch still reads all fields from the index.
filter_path is just applied when a document is serialized to JSON.
What about the class FilterPath I found here:
Can it be used to reduce the response? Or does this class have another purpose?
I not sure to understand how it works.
Filter path is a rest layer thing. The transport client doesn't do rest so
it isn't a thing. In 5.0 there are the beginnings of a rest client in Java
and it'll have those options.