1

I'm trying to limit my Java API-run Elasticsearch queries so that they only return some specific fields from _source.

The analogous query using the REST API looks like:

curl -X GET http://localhost:9200/ci_person/t/_search?q=name_s:ben&_source=name_s

How do I do this in Java?

searchRequestBuilder.addFields(<array of fields>); only returns set fields, but in doing so it completely changes the structure of the returned data (replacing _source with a nested field object). This isn't acceptable for what I'm doing, because specifying a set of fields to return shouldn't completely change what's returned.

2
  • 2
    This answer might help: stackoverflow.com/questions/38654281/… Commented Feb 8, 2017 at 16:51
  • Thanks, that looks like what I need. Commented Feb 8, 2017 at 16:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.