spring-data-elasticsearch icon indicating copy to clipboard operation
spring-data-elasticsearch copied to clipboard

Only index type possible for bulk inserts, causes error with data-streams

Open on-delete opened this issue 3 years ago • 8 comments

Currently, if you do a saveAll, the IndexQuery is build with OpType INDEX. This causes an error if you want to use it with a data-stream, as only create actions are allowed. Is this somehow planned to be implemented, that you can configure the query type on bulk inserts?

on-delete avatar Feb 17 '22 14:02 on-delete

currently it is not possible to set this. I change this issue to a feature request.

sothawo avatar Feb 17 '22 18:02 sothawo

Hey @sothawo just wanted to check if this enhancement will be implemented soon? Any update would be appreciated.

on-delete avatar Feb 09 '23 07:02 on-delete

Spring Data Elasticsearch is a community driven project, there is no dedicated team anywhere working on it. I as a project lead manage / review contributions and as a maintainer add code myself. But I'm doing this in my spare time. So issues have to wait until either someone from the community contributes or I find the time to implement them.

sothawo avatar Feb 09 '23 08:02 sothawo

It was just a question for an update on this issue, no demand that it should be implemented soon. Sorry if that came off wrong at your side. We will, of course, wait for the implementation.

Thanks for your work, appreciate the effort!

on-delete avatar Feb 09 '23 09:02 on-delete

just for the record... I stumbled upon this same point (datastream vs the missing optype on saving) and forked that part locally by adding the ability to get the optType from a parameter on Document annotation of a given Entity here https://github.com/spring-projects/spring-data-elasticsearch/blob/7092e04feb906a450170bc5311fae45f8f9cf0db/src/main/java/org/springframework/data/elasticsearch/core/AbstractElasticsearchTemplate.java#L582 ...which, obviously, I imagine not be appropriated... but would it be a good idea to allow it to be passed from the annotation to a more appropriate point on the code?

koshnarek avatar Aug 14 '23 21:08 koshnarek

Had no time yet to look intothis, but I think we should not add a detail like opType on the @Document annotation, but rather something like dataStream=true (having a default of false, and then at the different places where this information is needed - to set the op-type for example - refer to that value.

sothawo avatar Aug 16 '23 17:08 sothawo

and something like that? https://github.com/spring-projects/spring-data-elasticsearch/compare/main...koshnarek:spring-data-elasticsearch:main

koshnarek avatar Jan 23 '24 13:01 koshnarek

I,d rather put that as a property on the ElasticsearchPersistentEntity. I did not check yet, at what places this would be needed to be taken inot account

sothawo avatar Jan 24 '24 11:01 sothawo