2

The @Query annotation contains no options for this. I can't add -

{
  "_source": {
    "includes": [
      "id",
      "name",
      "address"
    ]
  },
  "query": {
    ...
  }
}

Projections don't work in ES repositories.

The only way is to make your own repository (NativeSearchQuery and ect.) or DTO? Why can't these things be made easier?

1 Answer 1

1

All the query implementations from Spring Data Elasticsearch have the possibility to set a source filter.

The @Query annotation can only contain the query part as you wrote, there is already a ticket to make this more flexible.

Why can't these things be made easier?

Well, Spring Data Elasticsearch is a community driven project, so if you want to contribute to it, you are welcome.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.