Commit 77851907 by Clinton Blackburn Committed by Clinton Blackburn

Added support for Elasticsearch 1.0+

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 d2018921
...@@ -11,9 +11,9 @@ before_install: ...@@ -11,9 +11,9 @@ before_install:
- gem update bundler # Ensure we use the latest version of bundler. Travis' default version of outdated. - gem update bundler # Ensure we use the latest version of bundler. Travis' default version of outdated.
# Run Elasticsearch as a daemon # Run Elasticsearch as a daemon
- curl -O https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.13.zip - curl -O https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.5.2.zip
- unzip elasticsearch-0.90.13.zip - unzip elasticsearch-1.5.2.zip
- elasticsearch-0.90.13/bin/elasticsearch - elasticsearch-1.5.2/bin/elasticsearch -d
# Run MongoDB as a daemon # Run MongoDB as a daemon
- curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.11.tgz - curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.11.tgz
......
...@@ -32,7 +32,7 @@ gem 'will_paginate_mongoid', "~>2.0" ...@@ -32,7 +32,7 @@ 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.0'
gem 'elasticsearch-model', '~> 0.1.8' gem 'elasticsearch-model', '~> 0.1.8'
gem 'dalli' gem 'dalli'
......
...@@ -55,16 +55,16 @@ GEM ...@@ -55,16 +55,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.0.15)
elasticsearch-api (= 0.4.11) elasticsearch-api (= 1.0.15)
elasticsearch-transport (= 0.4.11) elasticsearch-transport (= 1.0.15)
elasticsearch-api (0.4.11) elasticsearch-api (1.0.15)
multi_json multi_json
elasticsearch-model (0.1.8) elasticsearch-model (0.1.8)
activesupport (> 3) activesupport (> 3)
elasticsearch (> 0.4) elasticsearch (> 0.4)
hashie hashie
elasticsearch-transport (0.4.11) elasticsearch-transport (1.0.15)
faraday faraday
multi_json multi_json
enumerize (0.11.0) enumerize (0.11.0)
...@@ -191,7 +191,7 @@ DEPENDENCIES ...@@ -191,7 +191,7 @@ DEPENDENCIES
database_cleaner (~> 1.5.1) database_cleaner (~> 1.5.1)
delayed_job delayed_job
delayed_job_mongoid delayed_job_mongoid
elasticsearch (~> 0.4) elasticsearch (~> 1.0)
elasticsearch-model (~> 0.1.8) elasticsearch-model (~> 0.1.8)
enumerize enumerize
factory_girl (~> 4.0) factory_girl (~> 4.0)
......
...@@ -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
...@@ -27,14 +29,18 @@ def get_thread_ids(context, group_ids, local_params, search_text) ...@@ -27,14 +29,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
}
} }
} }
} }
......
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