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'
# Search
gem 'elasticsearch-model', '~> 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
gem 'html-pipeline', '~> 1.11.0'
......
......@@ -86,7 +86,7 @@ GEM
sass (>= 3.3.4)
brakeman (3.4.1)
browser (2.2.0)
builder (3.2.2)
builder (3.2.3)
bullet (5.2.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.10.0)
......@@ -169,17 +169,17 @@ GEM
railties (>= 4.2)
dropzonejs-rails (0.7.2)
rails (> 3.1)
elasticsearch (1.1.0)
elasticsearch-api (= 1.1.0)
elasticsearch-transport (= 1.1.0)
elasticsearch-api (1.1.0)
elasticsearch (5.0.3)
elasticsearch-api (= 5.0.3)
elasticsearch-transport (= 5.0.3)
elasticsearch-api (5.0.3)
multi_json
elasticsearch-model (0.1.9)
activesupport (> 3)
elasticsearch (> 0.4)
hashie
elasticsearch-rails (0.1.9)
elasticsearch-transport (1.1.0)
elasticsearch-transport (5.0.3)
faraday
multi_json
email_reply_trimmer (0.1.6)
......@@ -265,12 +265,12 @@ GEM
mime-types (>= 1.19)
rugged (>= 0.23.0b)
github-markup (1.4.0)
gitlab-elasticsearch-git (1.1.0)
gitlab-elasticsearch-git (1.1.1)
activemodel (~> 4.2)
activesupport (~> 4.2)
charlock_holmes (~> 0.7)
elasticsearch-api (~> 1.0)
elasticsearch-model (~> 0.1.8)
elasticsearch-api
elasticsearch-model (~> 0.1.9)
github-linguist (~> 4.7)
rugged (~> 0.24)
gitlab-flowdock-git-hook (1.0.1)
......@@ -353,7 +353,7 @@ GEM
temple (~> 0.7.6)
thor
tilt
hashie (3.4.4)
hashie (3.5.1)
health_check (2.2.1)
rails (>= 4.0)
hipchat (1.5.2)
......@@ -889,6 +889,7 @@ DEPENDENCIES
diffy (~> 3.1.0)
doorkeeper (~> 4.2.0)
dropzonejs-rails (~> 0.7.1)
elasticsearch-api (= 5.0.3)
elasticsearch-model (~> 0.1.9)
elasticsearch-rails (~> 0.1.9)
email_reply_trimmer (~> 0.1)
......@@ -908,7 +909,7 @@ DEPENDENCIES
gemnasium-gitlab-service (~> 0.2)
gemojione (~> 3.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-license (~> 1.0)
gitlab-markup (~> 1.5.1)
......
require 'gitlab/elastic/delete_by_query'
class ElasticIndexerWorker
include Sidekiq::Worker
include Elasticsearch::Model::Client::ClassMethods
......@@ -66,7 +64,7 @@ class ElasticIndexerWorker
end
def remove_documents_by_project_id(record_id)
client.gitlab_delete_by_query({
client.delete_by_query({
index: Project.__elasticsearch__.index_name,
body: {
query: {
......@@ -77,7 +75,7 @@ class ElasticIndexerWorker
end
def remove_children_documents(document_type, parent_record_id)
client.gitlab_delete_by_query({
client.delete_by_query({
index: Project.__elasticsearch__.index_name,
body: {
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