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:
- gem update bundler # Ensure we use the latest version of bundler. Travis' default version of outdated.
# Run Elasticsearch as a daemon
- curl -O https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.13.zip
- unzip elasticsearch-0.90.13.zip
- elasticsearch-0.90.13/bin/elasticsearch
- curl -O https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.5.2.zip
- unzip elasticsearch-1.5.2.zip
- elasticsearch-1.5.2/bin/elasticsearch -d
# Run MongoDB as a daemon
- 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"
gem 'rdiscount'
gem 'nokogiri', "~>1.6.8"
gem 'elasticsearch', '~> 0.4'
gem 'elasticsearch', '~> 1.0'
gem 'elasticsearch-model', '~> 0.1.8'
gem 'dalli'
......
......@@ -55,16 +55,16 @@ GEM
docile (1.1.5)
domain_name (0.5.24)
unf (>= 0.0.5, < 1.0.0)
elasticsearch (0.4.11)
elasticsearch-api (= 0.4.11)
elasticsearch-transport (= 0.4.11)
elasticsearch-api (0.4.11)
elasticsearch (1.0.15)
elasticsearch-api (= 1.0.15)
elasticsearch-transport (= 1.0.15)
elasticsearch-api (1.0.15)
multi_json
elasticsearch-model (0.1.8)
activesupport (> 3)
elasticsearch (> 0.4)
hashie
elasticsearch-transport (0.4.11)
elasticsearch-transport (1.0.15)
faraday
multi_json
enumerize (0.11.0)
......@@ -191,7 +191,7 @@ DEPENDENCIES
database_cleaner (~> 1.5.1)
delayed_job
delayed_job_mongoid
elasticsearch (~> 0.4)
elasticsearch (~> 1.0)
elasticsearch-model (~> 0.1.8)
enumerize
factory_girl (~> 4.0)
......
......@@ -12,11 +12,13 @@ def get_thread_ids(context, group_ids, local_params, search_text)
unless group_ids.empty?
filters.push(
{
or: [
bool: {
should: [
{:not => {:exists => {:field => :group_id}}},
{:terms => {:group_id => group_ids}}
]
}
}
)
end
......@@ -27,14 +29,18 @@ def get_thread_ids(context, group_ids, local_params, search_text)
{updated_at: :desc}
],
query: {
filtered: {
query: {
multi_match: {
query: search_text,
fields: [:title, :body],
operator: :AND
}
},
filtered: {
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