Elastica icon indicating copy to clipboard operation
Elastica copied to clipboard

Reindex API allows more customizations than the Reindex class implements

Open mweibel opened this issue 7 years ago • 6 comments

#1315 implemented the new reindex API but did so in a way that it's impossible to pass all possible options to the underlying API. Just a few examples of what the API allows but the Elastica implementation doesn't:

  • it allows to set query parameters (timeout, requests_per_second, wait_for_completion etc.)
  • it allows to adjust the batch size by setting a size on the source
  • it allows routing on the destination index
  • it allows importing from a remote source
  • it allows to copy from multiple sources into one destination

etc.

As it currently is implemented, the reindex class will prevent those possibilities and if that is being released, BC probably needs to be preserved, which is bad.

IMO the reindex class should just allow two parameters: options and params. The user of that class needs to specify the source and destination plus other options on it's own instead of relying on Elastica to assemble it.

mweibel avatar Jun 07 '17 07:06 mweibel

For the moment i've deprecated CrossIndex and implemented Reindex with same functionalities of CrossIndex (and little bit more). Sure we can implement in a next time more functionality. if you want contribute with some PR you are welcome!

giovannialbero1992 avatar Jun 09 '17 12:06 giovannialbero1992

@mweibel Thanks for bring this up. I agree it's a bit bad that this will probably break BC. +1 on implementing it in a more "flexible way" and allowing setParam or _setRawParam to be used as for most other Elastica objects.

I'm ok with breaking this in a minor release as think the benefit will outweight the pain we will cause. But we will have to add a bold "remark" about it.

ruflin avatar Jun 12 '17 09:06 ruflin

Hi @ruflin I think that now CrossIndex has been removed, the ReIndex class as @mweibel suggested should be fully in sync with ES 6.0 implementation, so it will be really useful implementing missing options.

p365labs avatar Nov 15 '17 11:11 p365labs

@p365labs +1

ruflin avatar Nov 16 '17 04:11 ruflin

Cool! I am interested in implementing this. @ruflin I am unsure about this though:

implementing it in a more "flexible way" and allowing setParam or _setRawParam to be used as for most other Elastica objects

Seems to be a a flexible way to implement this, but I am not familiar with this concept of Param. So far I looked at existing classes and found various different usages. Is there an existing class that would be a good example for how it should be used? Or maybe some other resource to understand that Parameter-thing?

daviscaics avatar Apr 23 '18 15:04 daviscaics

@daviscaics Great to hear you are interested in contributing. For the examples best have a look at the Query objects: https://github.com/ruflin/Elastica/tree/master/lib/Elastica/Query They all indirectly extend Param: https://github.com/ruflin/Elastica/blob/master/lib/Elastica/Param.php

ruflin avatar Apr 24 '18 07:04 ruflin