Explicitly create ES index #2023
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #1712 by explicitly creating the new Elasticsearch index when reindexing.
It seems like the behavior has changed since #1473: If we don't explicitly create the index, the default mapping that we get doesn't respect the
keyword
type for properties likeclassifier
, which results in them being consideredtext
instead, which results in them being tokenized and not matching exactly to their respective values.To prevent the
index_already_exists_exception
in #1473 from returning, we can now tellcreate
to block until all the shards become active. This should prevent the original (hypothesized) race condition betweencreate
, andparallel_bulk
attempting to auto-create the index. (It's hard to say whether this really will prevent it as I still haven't been able to reproduce it in dev, but a stale index is better than one that doesn't work at all...)