elasticsearch-data-cleaner 0.1.2 → 0.1.3
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/lib/elasticsearch-data-cleaner.rb +7 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e323def036e8ef511dd375547012c05964d735c5
|
4
|
+
data.tar.gz: eea9b4705763c035f42be56575f79b5792108175
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e7b863bc66f11da759232cd80bfe46dda7ca4b0da44a72985f8e9966fed9522e5a77b8eae055c9648aaaf206cdf5a449f7cdaef913ff3d28f7123c9c680eb2d
|
7
|
+
data.tar.gz: 56e68be2863a1d98db158c66127094cae902d22a4050d463c39ed328303528f5184e5af09ad3c83340d6186ee5895a61fb3344c4eaec7f85256c0230efa2b071
|
@@ -92,10 +92,15 @@ class EScleaner
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def optimize(index)
|
95
|
-
# Run _optimize
|
95
|
+
# Run _forcemerge or _optimize
|
96
|
+
if @es_version['major'] > 2 or (@es_version['major'] = 2 and @es_version['minor'] >= 1)
|
97
|
+
api = '_forcemerge'
|
98
|
+
else
|
99
|
+
api = '_optimize'
|
100
|
+
end
|
96
101
|
$logger.info("starting optimize for index #{index}#{@options.dry_run ? ' (dry_run)': ''}")
|
97
102
|
if !@options.dry_run
|
98
|
-
resp = @connection.post "#{index}
|
103
|
+
resp = @connection.post "#{index}/#{api}?only_expunge_deletes=true"
|
99
104
|
failed = (parse_response resp.body)['_shards']['failed']
|
100
105
|
if failed > 0
|
101
106
|
$logger.warn("optimizing of index #{index} returns #{failed} failed shards")
|