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

Generic handler #71

Merged
merged 3 commits into from Apr 28, 2015
Merged

Generic handler #71

merged 3 commits into from Apr 28, 2015

Conversation

nwolff
Copy link
Contributor

@nwolff nwolff commented Apr 28, 2015

The reindexer now takes a HitHandler than can emit any kind of BulkRequest
We provide a CopyToTargetIndex function to handle the common case of straighforward copying from one index to another.

Added a Fields method to ScanService that  allows the caller to speficy
the fields to load.

The Reindexer now requests the _parent and _router fields (on top of the default _source field).
When the reindexer finds those fields in the hit, it sets them on the IndexRequest.

In index_test:
Added a new 'comment' type that is a child of 'tweet' together with its mapping.
Added a comment instance to the test dataset.
@olivere
Copy link
Owner

olivere commented Apr 28, 2015

👍 Much better than before. Flexible and simpler design. Is Reindexer still a good name for this?

@olivere
Copy link
Owner

olivere commented Apr 28, 2015

If we're going to stay with Reindexer, maybe it's better to use ReindexerFunc for symmetry? (There also is a ReindexerProgressFunc)

@olivere
Copy link
Owner

olivere commented Apr 28, 2015

Okay, I see that you've renamed the callback. I think it's better now.

Are you still working on some details? Otherwise I'll merge it.

@nwolff
Copy link
Contributor Author

nwolff commented Apr 28, 2015

I think it's good like this. Thank you for pushing the enveloppe

@olivere olivere merged commit 4735257 into olivere:master Apr 28, 2015
olivere added a commit that referenced this pull request Apr 28, 2015
Added a Fields method to ScanService that allows the caller to speficy
the fields to load.

Redesigned the Reindexer and make it more generic. It now takes a
ReindexerFunc that is responsible for consuming a SearchHit and
handling the bulk operation (e.g. indexing, updating, deleting, or
skipping the document). The default operation is CopyToTargetIndex
which copies the SearchHit into the target index.

CopyToTargetIndex also gracefully handles the _parent and _routing fields
(on top of the default _source field).
When CopyToTargetIndex finds those fields in the hit, it sets them in the
IndexRequest.

Tests:
Added a new 'comment' type that is a child of 'tweet' together with its
mapping. Added a comment instance to the test dataset. Also added some
more Reindexer tests.

Thanks to @nwolff for this PR. Closes #68 and #71.
@olivere
Copy link
Owner

olivere commented Apr 28, 2015

It was a pleasure working with you. Thank you.

@nwolff nwolff deleted the generic-handler branch April 28, 2015 15:09
@nwolff
Copy link
Contributor Author

nwolff commented Apr 28, 2015

Same here, cheers!

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.

None yet

2 participants