-
Notifications
You must be signed in to change notification settings - Fork 369
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
ElasticSearch v. 8 upgrade #962
Changes from all commits
be832cd
9dcf571
f3f9512
1f7b8f8
94e7198
c9774a0
d8fd9aa
d2129a8
169fdb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: "3.4" | ||
services: | ||
elasticsearch_test: | ||
image: "elasticsearch:8.15.0" | ||
environment: | ||
- bootstrap.memory_lock=${ES_MEMORY_LOCK:-false} | ||
- "ES_JAVA_OPTS=-Xms${TEST_ES_HEAP_SIZE:-500m} -Xmx${TEST_ES_HEAP_SIZE:-500m}" | ||
- discovery.type=single-node | ||
- xpack.security.enabled=false | ||
ports: | ||
- "127.0.0.1:9250:9200" | ||
ulimits: | ||
nofile: | ||
soft: 65536 | ||
hard: 65536 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ def exists? | |
# | ||
def create(*args, **kwargs) | ||
create!(*args, **kwargs) | ||
rescue Elasticsearch::Transport::Transport::Errors::BadRequest | ||
rescue Elastic::Transport::Transport::Errors::BadRequest | ||
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. I see that we have very small difference between 7.x and 8.x, can we make it work with both version? For instance as a possibility, define these constants like if es_8?
ELASTIC_ERROR_NOT_BAD_REQUEST = Elastic::Transport::Transport::Errors::BadRequest end
else
ELASTIC_ERROR_NOT_BAD_REQUEST = Elasticsearch::Transport::Transport::Errors::BadRequest
end and use it
Or even make this prefix configurable
and then 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. Again, it's not likely that we need it: #962 (comment) |
||
false | ||
end | ||
|
||
|
@@ -83,9 +83,9 @@ def delete(suffix = nil) | |
result = client.indices.delete index: index_names.join(',') | ||
Chewy.wait_for_status if result | ||
result | ||
# es-ruby >= 1.0.10 handles Elasticsearch::Transport::Transport::Errors::NotFound | ||
# es-ruby >= 1.0.10 handles Elastic::Transport::Transport::Errors::NotFound | ||
# by itself, rescue is for previous versions | ||
rescue Elasticsearch::Transport::Transport::Errors::NotFound | ||
rescue Elastic::Transport::Transport::Errors::NotFound | ||
false | ||
end | ||
|
||
|
@@ -99,9 +99,9 @@ def delete(suffix = nil) | |
# UsersIndex.delete '01-2014' # deletes `users_01-2014` index | ||
# | ||
def delete!(suffix = nil) | ||
# es-ruby >= 1.0.10 handles Elasticsearch::Transport::Transport::Errors::NotFound | ||
# es-ruby >= 1.0.10 handles Elastic::Transport::Transport::Errors::NotFound | ||
# by itself, so it is raised here | ||
delete(suffix) or raise Elasticsearch::Transport::Transport::Errors::NotFound | ||
delete(suffix) or raise Elastic::Transport::Transport::Errors::NotFound | ||
end | ||
|
||
# Deletes and recreates index. Supports suffixes. | ||
|
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.
Can we use
services
for that? The same way we start redis.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.
@barthez the containers created this way is quite hard to configure (yeah, we have custom configs :D ) , given that the same containers needed for local development as well 🤷 so I find it quite convenient use docker compose based ES.
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.
Yeah, sorry, it's possible, I don't remember why we didn't use them from the start.