search_flip 3.8.0 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +11 -2
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +18 -1
- data/Gemfile +1 -1
- data/README.md +10 -0
- data/lib/search_flip/aggregation.rb +3 -3
- data/lib/search_flip/connection.rb +2 -2
- data/lib/search_flip/http_client.rb +1 -1
- data/lib/search_flip/version.rb +1 -1
- data/spec/search_flip/connection_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe72863b41e604e0e1faf6148099a0fd1e8f2619e9224dfc1a77015534574c5a
|
|
4
|
+
data.tar.gz: c199afecd685aebb5e250be8d0b4760e4b513e7aafc5475d45e471458dad12ae
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ade3326e113e4132f12d35d65b962145b8a3fc8ed9eddd2e6ae99dc235805486e578f665973e6db9e60e402f4a915c7f42785e70790f0e7adefdad62e6881824
|
|
7
|
+
data.tar.gz: 4660765f5157949a6729a7de370e7816c3400341fb9521cbec0209e091e42ce460670ff3744d3ffb2a7b3650a051caa404e67b8a77dd27da0af1ef7690be2bb2
|
data/.github/workflows/test.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
on: push
|
|
1
|
+
on: [push, pull_request]
|
|
2
2
|
name: test
|
|
3
3
|
jobs:
|
|
4
4
|
test:
|
|
@@ -27,7 +27,7 @@ jobs:
|
|
|
27
27
|
env:
|
|
28
28
|
discovery.type: single-node
|
|
29
29
|
xpack.security.enabled: false
|
|
30
|
-
- image: docker.elastic.co/elasticsearch/elasticsearch:8.
|
|
30
|
+
- image: docker.elastic.co/elasticsearch/elasticsearch:8.11.4
|
|
31
31
|
env:
|
|
32
32
|
discovery.type: single-node
|
|
33
33
|
xpack.security.enabled: false
|
|
@@ -39,6 +39,10 @@ jobs:
|
|
|
39
39
|
env:
|
|
40
40
|
discovery.type: single-node
|
|
41
41
|
plugins.security.disabled: true
|
|
42
|
+
- image: opensearchproject/opensearch:2.13.0
|
|
43
|
+
env:
|
|
44
|
+
discovery.type: single-node
|
|
45
|
+
DISABLE_SECURITY_PLUGIN: true
|
|
42
46
|
ruby:
|
|
43
47
|
- 2.7
|
|
44
48
|
- 3.0
|
|
@@ -50,6 +54,11 @@ jobs:
|
|
|
50
54
|
env: ${{ matrix.elasticsearch.env }}
|
|
51
55
|
ports:
|
|
52
56
|
- 9200:9200
|
|
57
|
+
options: >-
|
|
58
|
+
--health-cmd "curl -sf http://localhost:9200 || exit 1"
|
|
59
|
+
--health-interval 10s
|
|
60
|
+
--health-timeout 5s
|
|
61
|
+
--health-retries 30
|
|
53
62
|
steps:
|
|
54
63
|
- uses: actions/checkout@v1
|
|
55
64
|
- uses: ruby/setup-ruby@v1
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
|
|
2
2
|
# CHANGELOG
|
|
3
3
|
|
|
4
|
-
## v3.
|
|
4
|
+
## v3.9.1
|
|
5
|
+
|
|
6
|
+
* Fix compatibility with http.rb version 6
|
|
7
|
+
|
|
8
|
+
## v3.9.0
|
|
9
|
+
|
|
10
|
+
* Allow to configure the elasticsearch version no matter which elasticsearch
|
|
11
|
+
version is actually in use. The version information is needed to support
|
|
12
|
+
version dependent features. Please note that manually configuring the version
|
|
13
|
+
is usually not need as the version by default is determined by sending one
|
|
14
|
+
request to elasticsearch.
|
|
15
|
+
|
|
16
|
+
```ruby
|
|
17
|
+
SearchFlip::Config[:version] = { number: "8.1.1" }
|
|
18
|
+
SearchFlip::Config[:version] = { number: "2.13", distribution: "opensearch" }
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## v3.8.0
|
|
5
22
|
|
|
6
23
|
* Support Opensearch 1.x and 2.x
|
|
7
24
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -98,6 +98,16 @@ Available config options are:
|
|
|
98
98
|
* `auto_refresh` tells SearchFlip to automatically refresh an index after
|
|
99
99
|
import, index, delete, etc operations. This is e.g. useful for testing, etc.
|
|
100
100
|
Defaults to false.
|
|
101
|
+
* `version` allows to configure the elasticsearch version no matter which
|
|
102
|
+
elasticsearch version is actually in use. The version information is needed to
|
|
103
|
+
support version dependent features. Please note that manually configuring the
|
|
104
|
+
version is usually not need as the version by default is determined by sending
|
|
105
|
+
one request to elasticsearch.
|
|
106
|
+
|
|
107
|
+
```ruby
|
|
108
|
+
SearchFlip::Config[:version] = { number: "8.1.1" }
|
|
109
|
+
SearchFlip::Config[:version] = { number: "2.13", distribution: "opensearch" }
|
|
110
|
+
```
|
|
101
111
|
|
|
102
112
|
## Usage
|
|
103
113
|
|
|
@@ -33,9 +33,9 @@ module SearchFlip
|
|
|
33
33
|
if target.connection.distribution || target.connection.version.to_i >= 2
|
|
34
34
|
res[:filter] = {
|
|
35
35
|
bool: {}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
.merge(must_values ? { must: must_values } : {})
|
|
37
|
+
.merge(must_not_values ? { must_not: must_not_values } : {})
|
|
38
|
+
.merge(filter_values ? { filter: filter_values } : {})
|
|
39
39
|
}
|
|
40
40
|
else
|
|
41
41
|
filters = (filter_values || []) + (must_not_values || []).map { |must_not_value| { not: must_not_value } }
|
|
@@ -26,7 +26,7 @@ module SearchFlip
|
|
|
26
26
|
# @return [String] The Elasticsearch distribution
|
|
27
27
|
|
|
28
28
|
def distribution
|
|
29
|
-
@distribution ||= SearchFlip::JSON.parse(version_response.to_s)["version"]["distribution"]
|
|
29
|
+
@distribution ||= SearchFlip::Config.dig(:version, :distribution) || SearchFlip::JSON.parse(version_response.to_s)["version"]["distribution"]
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
# Queries and returns the Elasticsearch version used.
|
|
@@ -37,7 +37,7 @@ module SearchFlip
|
|
|
37
37
|
# @return [String] The Elasticsearch version
|
|
38
38
|
|
|
39
39
|
def version
|
|
40
|
-
@version ||= SearchFlip::JSON.parse(version_response.to_s)["version"]["number"]
|
|
40
|
+
@version ||= SearchFlip::Config.dig(:version, :number) || SearchFlip::JSON.parse(version_response.to_s)["version"]["number"]
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
# Queries and returns the Elasticsearch cluster health.
|
|
@@ -73,7 +73,7 @@ module SearchFlip
|
|
|
73
73
|
final_request = plugins.inject(final_request) { |res, cur| cur.call(res, method, uri, opts) }
|
|
74
74
|
final_request = final_request.headers({}) # Prevent thread-safety issue of http-rb: https://github.com/httprb/http/issues/558
|
|
75
75
|
|
|
76
|
-
response = final_request.request.send(method, uri, opts)
|
|
76
|
+
response = final_request.request.send(method, uri, **opts)
|
|
77
77
|
|
|
78
78
|
raise SearchFlip::ResponseError.new(code: response.code, body: response.body.to_s) unless response.status.success?
|
|
79
79
|
|
data/lib/search_flip/version.rb
CHANGED
|
@@ -5,12 +5,28 @@ RSpec.describe SearchFlip::Connection do
|
|
|
5
5
|
it "reutrns the distribution" do
|
|
6
6
|
expect([nil, "opensearch"]).to include(SearchFlip::Connection.new.distribution)
|
|
7
7
|
end
|
|
8
|
+
|
|
9
|
+
it "returns the distribution from the config when given" do
|
|
10
|
+
SearchFlip::Config[:version] = { distribution: "distribution" }
|
|
11
|
+
|
|
12
|
+
expect(SearchFlip::Connection.new.distribution).to eq("distribution")
|
|
13
|
+
ensure
|
|
14
|
+
SearchFlip::Config.delete(:version)
|
|
15
|
+
end
|
|
8
16
|
end
|
|
9
17
|
|
|
10
18
|
describe "#version" do
|
|
11
19
|
it "returns the version" do
|
|
12
20
|
expect(SearchFlip::Connection.new.version).to match(/\A[0-9.]+\z/)
|
|
13
21
|
end
|
|
22
|
+
|
|
23
|
+
it "returns the version from the config when given" do
|
|
24
|
+
SearchFlip::Config[:version] = { number: "1.2.3" }
|
|
25
|
+
|
|
26
|
+
expect(SearchFlip::Connection.new.version).to eq("1.2.3")
|
|
27
|
+
ensure
|
|
28
|
+
SearchFlip::Config.delete(:version)
|
|
29
|
+
end
|
|
14
30
|
end
|
|
15
31
|
|
|
16
32
|
describe "#cluster_health" do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: search_flip
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Benjamin Vetter
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-05-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: hashie
|