spring-projects/spring-data-elasticsearch

Allow providing pipeline on simple save and/or on repository

CezaryStasiak opened this issue · 2 comments

Elastic allows to pass pipeline name on save request (https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html#add-pipeline-to-indexing-request). It would be nice to have this ability with spring data. Extended .save() with another parameter or @ Pipeline annotation for index class so it would work for all saved documents for given index.

Given that IndexCoordinates looks like a place that deals with url parts it could be extended with pipeline . Then in ElasticsearchRepository:
<S extends T> S save(S entity, @Nullable IndexCoordinates indexCoordinates);
and handling that at the end in documentIndexRequest (RequestConverter)
if (indexCoordinates.getPipeline != null) { builder.pipeline(indexCoordinates.getPipeline()); }

Of course I have no idea if thats a good place for it.

IndexCoordinates has nothing to do with URL parts, it's a collection of index names. Adding information lioke a pipeline name there would only enable it for methods that use one of the API calls that use IndexCoordinates. Don't know yet where the best place for this information is.