-
Notifications
You must be signed in to change notification settings - Fork 3
ES8 (and OpenSearch) support #37
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
772a4ed
Fix failing tests
jekelly-adobe 2fde740
I think it is ES8 compliant now, need to add unit tests
jekelly-adobe 3988373
Added unit tests for es 8+
jekelly-adobe b24eb69
Support update in es8 by actually using index
jekelly-adobe 8767f9e
mix format
williamge fda6b17
cleanup
williamge b3a97fe
my long-winded fight for running es8 tests has concluded, an es7 and …
williamge 05e50d4
removing get_env -> compile_env
williamge 105979f
removing elasticsearch 8 tags
williamge 72439cb
restoring tests that weren't covered for non-es7 before
williamge 9585c8e
reverting the change to Repo.update, updating bulk operation instead
williamge ff39af7
matching against status code in tests because its way too easy to bre…
williamge 3295aca
removing that test ssh
williamge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,33 +22,46 @@ defmodule ExlasticSearch.BulkOperation do | |
| def bulk_operation({op_type, struct}), do: bulk_operation_default({op_type, struct, :index}) | ||
|
|
||
| defp bulk_operation_default({op_type, %{__struct__: model} = struct, index}) do | ||
| op = %{ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. from here until the tests the code should be unchanged from #31 |
||
| _id: Indexable.id(struct), | ||
| _index: model.__es_index__(index) | ||
| } | ||
|
|
||
| op = | ||
| if doc_type = model.__doc_type__(), | ||
| do: Map.put(op, :_type, doc_type), | ||
| else: op | ||
|
|
||
| [ | ||
| %{ | ||
| op_type => %{ | ||
| _id: Indexable.id(struct), | ||
| _index: model.__es_index__(index), | ||
| _type: model.__doc_type__() | ||
| } | ||
| }, | ||
| %{op_type => op}, | ||
| build_document(struct, index) | ||
| ] | ||
| end | ||
|
|
||
| defp bulk_operation_update({:update, struct, id, data, index}) do | ||
| [ | ||
| %{update: %{_id: id, _index: struct.__es_index__(index), _type: struct.__doc_type__()}}, | ||
| data | ||
| ] | ||
| op = %{_id: id, _index: struct.__es_index__(index)} | ||
|
|
||
| if doc_type = struct.__doc_type__(), | ||
| do: Map.put(op, :_type, doc_type), | ||
| else: op | ||
|
|
||
| [%{update: op}, data] | ||
| end | ||
|
|
||
| defp bulk_operation_delete({:delete, %{__struct__: model} = struct, index}) do | ||
| op = %{ | ||
| _id: Indexable.id(struct), | ||
| _index: model.__es_index__(index) | ||
| } | ||
|
|
||
| op = | ||
| if doc_type = model.__doc_type__(), | ||
| do: Map.put(op, :_type, doc_type), | ||
| else: op | ||
|
|
||
| [ | ||
| %{ | ||
| delete: %{ | ||
| _id: Indexable.id(struct), | ||
| _index: model.__es_index__(index), | ||
| _type: model.__doc_type__() | ||
| } | ||
| delete: op | ||
| } | ||
| ] | ||
| end | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it would be nice to have testing against an opensearch docker container would be nice too, but I'm not sure of an elegant way to add that in here.
any suggestions on how to do that in a simple way, or on how to clean up my heavy-handed matrix approach, would be much appreciated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To start an OpenSearch container for testing, you can follow a pattern like this (adding Kafka container for testing): https://github.com/Frameio/massdriver/pull/18087/files#diff-95557d53bf91069e59d82b9d8fcfaf52ec84a762858983edd5ef3c9b3e4c8191R72