Commit 5a6f0fb3 by Clinton Blackburn Committed by Robert Raposa

Add support for Elasticsearch 1.5.2

Elasticsearch 0.90.x is quite out-of-date, and this requirement is preventing us from sharing an ES cluster with newer IDAs.

ECOM-3261 and SOL-295
parent 23d1a1f9
...@@ -3,7 +3,7 @@ version: "2" ...@@ -3,7 +3,7 @@ version: "2"
services: services:
elasticsearch: elasticsearch:
image: edxops/elasticsearch:0.9.13 image: elasticsearch:1.5.2
container_name: "es.edx" container_name: "es.edx"
mongo: mongo:
image: mongo:3.0.14 image: mongo:3.0.14
......
...@@ -34,8 +34,8 @@ gem 'will_paginate_mongoid', "~>2.0" ...@@ -34,8 +34,8 @@ gem 'will_paginate_mongoid', "~>2.0"
gem 'rdiscount' gem 'rdiscount'
gem 'nokogiri', "~>1.6.8" gem 'nokogiri', "~>1.6.8"
gem 'elasticsearch', '~> 0.4' gem 'elasticsearch', '~> 1.1.2'
gem 'elasticsearch-model', '~> 0.1.8' gem 'elasticsearch-model', '~> 0.1.9'
gem 'dalli' gem 'dalli'
......
...@@ -54,16 +54,16 @@ GEM ...@@ -54,16 +54,16 @@ GEM
docile (1.1.5) docile (1.1.5)
domain_name (0.5.24) domain_name (0.5.24)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
elasticsearch (0.4.11) elasticsearch (1.1.2)
elasticsearch-api (= 0.4.11) elasticsearch-api (= 1.1.2)
elasticsearch-transport (= 0.4.11) elasticsearch-transport (= 1.1.2)
elasticsearch-api (0.4.11) elasticsearch-api (1.1.2)
multi_json multi_json
elasticsearch-model (0.1.8) elasticsearch-model (0.1.9)
activesupport (> 3) activesupport (> 3)
elasticsearch (> 0.4) elasticsearch (> 0.4)
hashie hashie
elasticsearch-transport (0.4.11) elasticsearch-transport (1.1.2)
faraday faraday
multi_json multi_json
enumerize (0.11.0) enumerize (0.11.0)
...@@ -72,7 +72,7 @@ GEM ...@@ -72,7 +72,7 @@ GEM
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
faker (1.6.1) faker (1.6.1)
i18n (~> 0.5) i18n (~> 0.5)
faraday (0.9.2) faraday (0.11.0)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
guard (1.3.2) guard (1.3.2)
listen (>= 0.4.2) listen (>= 0.4.2)
...@@ -80,7 +80,7 @@ GEM ...@@ -80,7 +80,7 @@ GEM
guard-unicorn (0.0.7) guard-unicorn (0.0.7)
guard (>= 1.1) guard (>= 1.1)
hashdiff (0.2.3) hashdiff (0.2.3)
hashie (3.4.3) hashie (3.4.6)
http-cookie (1.0.2) http-cookie (1.0.2)
domain_name (~> 0.5) domain_name (~> 0.5)
i18n (0.7.0) i18n (0.7.0)
...@@ -106,7 +106,7 @@ GEM ...@@ -106,7 +106,7 @@ GEM
mongoid_magic_counter_cache (1.1.1) mongoid_magic_counter_cache (1.1.1)
mongoid mongoid
rake rake
multi_json (1.11.2) multi_json (1.12.1)
multipart-post (2.0.0) multipart-post (2.0.0)
netrc (0.10.3) netrc (0.10.3)
newrelic_rpm (3.16.0.318) newrelic_rpm (3.16.0.318)
...@@ -191,8 +191,8 @@ DEPENDENCIES ...@@ -191,8 +191,8 @@ DEPENDENCIES
dalli dalli
delayed_job delayed_job
delayed_job_mongoid delayed_job_mongoid
elasticsearch (~> 0.4) elasticsearch (~> 1.1.2)
elasticsearch-model (~> 0.1.8) elasticsearch-model (~> 0.1.9)
enumerize enumerize
factory_girl (~> 4.0) factory_girl (~> 4.0)
faker (~> 1.6) faker (~> 1.6)
......
...@@ -12,10 +12,12 @@ def get_thread_ids(context, group_ids, local_params, search_text) ...@@ -12,10 +12,12 @@ def get_thread_ids(context, group_ids, local_params, search_text)
unless group_ids.empty? unless group_ids.empty?
filters.push( filters.push(
{ {
or: [ bool: {
{:not => {:exists => {:field => :group_id}}}, should: [
{:terms => {:group_id => group_ids}} {:not => {:exists => {:field => :group_id}}},
] {:terms => {:group_id => group_ids}}
]
}
} }
) )
end end
...@@ -26,14 +28,18 @@ def get_thread_ids(context, group_ids, local_params, search_text) ...@@ -26,14 +28,18 @@ def get_thread_ids(context, group_ids, local_params, search_text)
{updated_at: :desc} {updated_at: :desc}
], ],
query: { query: {
multi_match: {
query: search_text,
fields: [:title, :body],
operator: :AND
},
filtered: { filtered: {
query: {
multi_match: {
query: search_text,
fields: [:title, :body],
operator: :AND
}
},
filter: { filter: {
and: filters bool: {
must: filters
}
} }
} }
} }
......
...@@ -175,7 +175,7 @@ module TaskHelpers ...@@ -175,7 +175,7 @@ module TaskHelpers
fail "Alias '#{alias_name}' does not exist." fail "Alias '#{alias_name}' does not exist."
end end
actual_mapping = Elasticsearch::Model.client.indices.get_mapping(index: alias_name).values[0] actual_mapping = Elasticsearch::Model.client.indices.get_mapping(index: alias_name).values[0]['mappings']
expected_mapping = {} expected_mapping = {}
[CommentThread, Comment].each do |model| [CommentThread, Comment].each do |model|
expected_mapping.merge! model.mappings.to_hash expected_mapping.merge! model.mappings.to_hash
......
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