1

As elasticsearch doc shows that we can execute query like this:

curl -XPOST 'localhost:9200/bank/_search?pretty' -d '
{
  "query": { "match_all": {} },
  "_source": ["account_number", "balance"]
}'

How can I do this query in spring data elasticsearch library?

1
  • I've been searching too and so far, I don't see a way to add "source" as a criteria to the NativeSearchQueryBuilder(). Commented Aug 5, 2015 at 22:38

1 Answer 1

1

As of release 1.2.0, it appears source filtering isn't available. It is supported within the Elasticsearch native Java API. I've created a pull request to implement _source field filtering here:

https://github.com/spring-projects/spring-data-elasticsearch/pull/115

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks , finally I choose to use template query to do it

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.