default spring data elasticsearch `CrudRepository` doesn't support routing

Viewed 18

Spring data CrudRepository's findById method is useful and handy to use, but in spring-data-elasticsearch, we should specify not only id but routing attribute together to find a doc in index with multiple shards.

  1. Does it mean CrudRepository#findById is useless or even misleading(if _id is not equal to _routing) in spring-data-elasticsearch?
  2. Is there any way to find a doc by id and routing, without construct a search request manually, in spring-data-elasticsearch?

Any suggestion would be appreciated!

1 Answers
Related