Commit 4901e17f authored by Valery Sizov's avatar Valery Sizov

ES: remove custom delete_by_query action as original one is already fixed

parent 16cec81c
...@@ -106,7 +106,8 @@ gem 'seed-fu', '~> 2.3.5' ...@@ -106,7 +106,8 @@ gem 'seed-fu', '~> 2.3.5'
# Search # Search
gem 'elasticsearch-model', '~> 0.1.9' gem 'elasticsearch-model', '~> 0.1.9'
gem 'elasticsearch-rails', '~> 0.1.9' gem 'elasticsearch-rails', '~> 0.1.9'
gem 'gitlab-elasticsearch-git', '~> 1.1', require: "elasticsearch/git" gem 'elasticsearch-api', '5.0.3'
gem 'gitlab-elasticsearch-git', '1.1.1', require: "elasticsearch/git"
# Markdown and HTML processing # Markdown and HTML processing
gem 'html-pipeline', '~> 1.11.0' gem 'html-pipeline', '~> 1.11.0'
......
...@@ -86,7 +86,7 @@ GEM ...@@ -86,7 +86,7 @@ GEM
sass (>= 3.3.4) sass (>= 3.3.4)
brakeman (3.4.1) brakeman (3.4.1)
browser (2.2.0) browser (2.2.0)
builder (3.2.2) builder (3.2.3)
bullet (5.2.0) bullet (5.2.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
uniform_notifier (~> 1.10.0) uniform_notifier (~> 1.10.0)
...@@ -169,17 +169,17 @@ GEM ...@@ -169,17 +169,17 @@ GEM
railties (>= 4.2) railties (>= 4.2)
dropzonejs-rails (0.7.2) dropzonejs-rails (0.7.2)
rails (> 3.1) rails (> 3.1)
elasticsearch (1.1.0) elasticsearch (5.0.3)
elasticsearch-api (= 1.1.0) elasticsearch-api (= 5.0.3)
elasticsearch-transport (= 1.1.0) elasticsearch-transport (= 5.0.3)
elasticsearch-api (1.1.0) elasticsearch-api (5.0.3)
multi_json multi_json
elasticsearch-model (0.1.9) elasticsearch-model (0.1.9)
activesupport (> 3) activesupport (> 3)
elasticsearch (> 0.4) elasticsearch (> 0.4)
hashie hashie
elasticsearch-rails (0.1.9) elasticsearch-rails (0.1.9)
elasticsearch-transport (1.1.0) elasticsearch-transport (5.0.3)
faraday faraday
multi_json multi_json
email_reply_trimmer (0.1.6) email_reply_trimmer (0.1.6)
...@@ -265,12 +265,12 @@ GEM ...@@ -265,12 +265,12 @@ GEM
mime-types (>= 1.19) mime-types (>= 1.19)
rugged (>= 0.23.0b) rugged (>= 0.23.0b)
github-markup (1.4.0) github-markup (1.4.0)
gitlab-elasticsearch-git (1.1.0) gitlab-elasticsearch-git (1.1.1)
activemodel (~> 4.2) activemodel (~> 4.2)
activesupport (~> 4.2) activesupport (~> 4.2)
charlock_holmes (~> 0.7) charlock_holmes (~> 0.7)
elasticsearch-api (~> 1.0) elasticsearch-api
elasticsearch-model (~> 0.1.8) elasticsearch-model (~> 0.1.9)
github-linguist (~> 4.7) github-linguist (~> 4.7)
rugged (~> 0.24) rugged (~> 0.24)
gitlab-flowdock-git-hook (1.0.1) gitlab-flowdock-git-hook (1.0.1)
...@@ -353,7 +353,7 @@ GEM ...@@ -353,7 +353,7 @@ GEM
temple (~> 0.7.6) temple (~> 0.7.6)
thor thor
tilt tilt
hashie (3.4.4) hashie (3.5.1)
health_check (2.2.1) health_check (2.2.1)
rails (>= 4.0) rails (>= 4.0)
hipchat (1.5.2) hipchat (1.5.2)
...@@ -889,6 +889,7 @@ DEPENDENCIES ...@@ -889,6 +889,7 @@ DEPENDENCIES
diffy (~> 3.1.0) diffy (~> 3.1.0)
doorkeeper (~> 4.2.0) doorkeeper (~> 4.2.0)
dropzonejs-rails (~> 0.7.1) dropzonejs-rails (~> 0.7.1)
elasticsearch-api (= 5.0.3)
elasticsearch-model (~> 0.1.9) elasticsearch-model (~> 0.1.9)
elasticsearch-rails (~> 0.1.9) elasticsearch-rails (~> 0.1.9)
email_reply_trimmer (~> 0.1) email_reply_trimmer (~> 0.1)
...@@ -908,7 +909,7 @@ DEPENDENCIES ...@@ -908,7 +909,7 @@ DEPENDENCIES
gemnasium-gitlab-service (~> 0.2) gemnasium-gitlab-service (~> 0.2)
gemojione (~> 3.0) gemojione (~> 3.0)
github-linguist (~> 4.7.0) github-linguist (~> 4.7.0)
gitlab-elasticsearch-git (~> 1.1) gitlab-elasticsearch-git (= 1.1.1)
gitlab-flowdock-git-hook (~> 1.0.1) gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-license (~> 1.0) gitlab-license (~> 1.0)
gitlab-markup (~> 1.5.1) gitlab-markup (~> 1.5.1)
......
require 'gitlab/elastic/delete_by_query'
class ElasticIndexerWorker class ElasticIndexerWorker
include Sidekiq::Worker include Sidekiq::Worker
include Elasticsearch::Model::Client::ClassMethods include Elasticsearch::Model::Client::ClassMethods
...@@ -66,7 +64,7 @@ class ElasticIndexerWorker ...@@ -66,7 +64,7 @@ class ElasticIndexerWorker
end end
def remove_documents_by_project_id(record_id) def remove_documents_by_project_id(record_id)
client.gitlab_delete_by_query({ client.delete_by_query({
index: Project.__elasticsearch__.index_name, index: Project.__elasticsearch__.index_name,
body: { body: {
query: { query: {
...@@ -77,7 +75,7 @@ class ElasticIndexerWorker ...@@ -77,7 +75,7 @@ class ElasticIndexerWorker
end end
def remove_children_documents(document_type, parent_record_id) def remove_children_documents(document_type, parent_record_id)
client.gitlab_delete_by_query({ client.delete_by_query({
index: Project.__elasticsearch__.index_name, index: Project.__elasticsearch__.index_name,
body: { body: {
query: { query: {
......
module Elasticsearch
module API
module Actions
# The built-in action https://github.com/elastic/elasticsearch-ruby/blob/master/elasticsearch-api/lib/elasticsearch/api/actions/delete_by_query.rb
# does not work with Elasticsearch 5.0 yet. There is an issue for that https://github.com/elastic/elasticsearch-ruby/issues/387
# but until it's not fixed we can use our own action for that
def gitlab_delete_by_query(arguments = {})
raise ArgumentError, "Required argument 'index' missing" unless arguments[:index]
valid_params = [
:analyzer,
:consistency,
:default_operator,
:df,
:ignore_indices,
:ignore_unavailable,
:allow_no_indices,
:expand_wildcards,
:replication,
:q,
:routing,
:source,
:timeout ]
method = HTTP_POST
path = Utils.__pathify Utils.__listify(arguments[:index]),
Utils.__listify(arguments[:type]),
'/_delete_by_query'
params = Utils.__validate_and_extract_params arguments, valid_params
body = arguments[:body]
perform_request(method, path, params, body).body
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment