Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements on the Reindex API #1752

Merged
merged 5 commits into from
Feb 12, 2020
Merged

Conversation

renanbr
Copy link
Contributor

@renanbr renanbr commented Jan 24, 2020

Reindex improvements:

  • Add pipeline support
    • Add Reindex::PIPELINE
    • Add $reindex->setPipeline(Pipeline $pipeline)
  • Improve refresh support
    • Add $reindex->setRefresh(bool|string $value)
  • Improve query support
    • Add $reindex->setQuery(AbstractQuery $query)
  • Add slices support
    • Add Reindex::SLICES
    • Add Reindex::SLICES_AUTO

... and also:

  • Add $pipeline->getId()

$this->setParam(self::PIPELINE, $pipeline);
}

public function setRefresh($value): void
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we force the value type to be bool $value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The valid values are: true, false and wait_for.
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#docs-reindex-api-query-params

We could also create some class constants for them.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like your solution, it would be cleaner IMHO and would allow us to validate the parameter... or should it be something for the lower-level client library? 🤔

@ruflin , what do you think?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I like the idea of validation at the same time it can put a burden on "us". Class constant would definitively be helpful but i would not validate that only these are used. If a new param is introduced in ES, we need to add it to support it which I don't think it optimal. Happy to also only have the most common / used ones as constants (or none to get started).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I quite agree with the "burden", I just wanted to have a more strict typing here.
IIRC Elasticsearch accepts "true" (as string) and true (as boolean) as equals. if that's the case: we can allow setRefresh(string $value) and define 3 public constants as "true" "false" and "wait_for".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some constants via fb3e933

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the new fixes, what about only allowing string as parameter here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #1758

Copy link
Owner

@ruflin ruflin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a changelog entry?

@renanbr
Copy link
Contributor Author

renanbr commented Feb 12, 2020

Could you add a changelog entry?

done via 06ffaa7

Copy link
Owner

@ruflin ruflin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only nit in the Changelog. @thePanz Are you ok with merging?

CHANGELOG.md Outdated
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased](https://github.com/ruflin/Elastica/compare/7.0.0-beta.3...master)
### Backward Compatibility Breaks
### Added
* Added `Elastica\Reindex->setPipeline(Elastica\Pipeline $pipeline): void`. The link between the reindex and the pipeline is solved when `run()` is called, and thus the pipeline given doesn't need to be created before calling `setPipeline()`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Could you add the links to the PR's? I'm just realising we miss it in some entries below too :-(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done aa5d5f5 :-)

@thePanz
Copy link
Collaborator

thePanz commented Feb 12, 2020

@ruflin LGTM, just one comment about the "setRefresh()" parameters

@ruflin ruflin merged commit 8544a91 into ruflin:master Feb 12, 2020
@ruflin
Copy link
Owner

ruflin commented Feb 12, 2020

I merged this PR to get it in. I see @renanbr 👍 your comment so I assume there will be a follow up PR? :-)

@renanbr
Copy link
Contributor Author

renanbr commented Feb 12, 2020

I merged this PR to get it in. I see @renanbr your comment so I assume there will be a follow up PR? :-)

yes, I'll do it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants