elastic_searchable 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,7 @@ module ElasticSearchable
13
13
  # http://www.elasticsearch.com/docs/elasticsearch/rest_api/admin/indices/put_mapping/
14
14
  def update_index_mapping
15
15
  if mapping = self.elastic_options[:mapping]
16
- ElasticSearchable.request :put, index_type_path('_mapping'), :body => {index_type => mapping}
16
+ ElasticSearchable.request :put, index_type_path('_mapping'), :json_body => {index_type => mapping}
17
17
  end
18
18
  end
19
19
 
@@ -23,7 +23,7 @@ module ElasticSearchable
23
23
  options = {}
24
24
  options.merge! :settings => self.elastic_options[:index_options] if self.elastic_options[:index_options]
25
25
  options.merge! :mappings => {index_type => self.elastic_options[:mapping]} if self.elastic_options[:mapping]
26
- ElasticSearchable.request :put, index_path, :body => options
26
+ ElasticSearchable.request :put, index_path, :json_body => options
27
27
  end
28
28
 
29
29
  # explicitly refresh the index, making all operations performed since the last refresh
@@ -114,7 +114,7 @@ module ElasticSearchable
114
114
  def reindex(lifecycle = nil)
115
115
  query = {}
116
116
  query.merge! :percolate => "*" if _percolate_callbacks.any?
117
- response = ElasticSearchable.request :put, self.class.index_type_path(self.id), :query => query, :body => self.as_json_for_index
117
+ response = ElasticSearchable.request :put, self.class.index_type_path(self.id), :query => query, :json_body => self.as_json_for_index
118
118
 
119
119
  self.index_lifecycle = lifecycle ? lifecycle.to_sym : nil
120
120
  _run_index_callbacks
@@ -139,7 +139,7 @@ module ElasticSearchable
139
139
  # can be done automatically when indexing using :percolate => true config option
140
140
  # http://www.elasticsearch.org/blog/2011/02/08/percolator.html
141
141
  def percolate
142
- response = ElasticSearchable.request :get, self.class.index_type_path('_percolate'), :body => {:doc => self.as_json_for_index}
142
+ response = ElasticSearchable.request :get, self.class.index_type_path('_percolate'), :json_body => {:doc => self.as_json_for_index}
143
143
  self.percolations = response['matches'] || []
144
144
  self.percolations
145
145
  end
@@ -33,7 +33,7 @@ module ElasticSearchable
33
33
  query[:sort] = sort
34
34
  end
35
35
 
36
- response = ElasticSearchable.request :get, index_type_path('_search'), :query => query, :body => options
36
+ response = ElasticSearchable.request :get, index_type_path('_search'), :query => query, :json_body => options
37
37
  hits = response['hits']
38
38
  ids = hits['hits'].collect {|h| h['_id'].to_i }
39
39
  results = self.find(ids).sort_by {|result| ids.index(result.id) }
@@ -1,4 +1,4 @@
1
1
  module ElasticSearchable
2
- VERSION = '1.1.3'
2
+ VERSION = '1.1.4'
3
3
  end
4
4
 
@@ -33,7 +33,7 @@ module ElasticSearchable
33
33
  # ElasticSearchable.debug_output outputs all http traffic to console
34
34
  def request(method, url, options = {})
35
35
  options.merge! :headers => {'Content-Type' => 'application/json'}
36
- options.merge! :body => ElasticSearchable.encode_json(options[:body]) if options[:body]
36
+ options.merge! :body => ElasticSearchable.encode_json(options[:json_body]) if options[:json_body]
37
37
 
38
38
  response = self.send(method, url, options)
39
39
  logger.debug "elasticsearch request: #{method} #{url} #{"took #{response['took']}ms" if response['took']}"
@@ -384,7 +384,7 @@ class TestElasticSearchable < Test::Unit::TestCase
384
384
  end
385
385
  context "when index has configured percolation" do
386
386
  setup do
387
- ElasticSearchable.request :put, '/_percolator/elastic_searchable/myfilter', :body => {:query => {:query_string => {:query => 'foo' }}}
387
+ ElasticSearchable.request :put, '/_percolator/elastic_searchable/myfilter', :json_body => {:query => {:query_string => {:query => 'foo' }}}
388
388
  ElasticSearchable.request :post, '/_percolator/_refresh'
389
389
  end
390
390
  context 'creating an object that does not match the percolation' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elastic_searchable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 3
10
- version: 1.1.3
9
+ - 4
10
+ version: 1.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ryan Sonnek