Open cjba7 opened 2 years ago
Aloha,
The ruby API gem, 'elasticsearch-api', alongside this gem seem to send a parameter on all requests when using 8.5 (also tested on 8.4 and 8.3).
At present I've got 7.5.0 in the Gemfile and all works as expected with an ES8.5 cluster.
Gemfile gem 'elasticsearch', '7.5.0' gem 'elasticsearch-api', '7.5.0' gem 'elasticsearch-model' gem 'elasticsearch-rails' Gemfile.lock elasticsearch (7.5.0) elasticsearch-api (= 7.5.0) elasticsearch-transport (= 7.5.0) elasticsearch-api (7.5.0) multi_json elasticsearch-model (7.2.1) activesupport (> 3) elasticsearch (~> 7) hashie elasticsearch-rails (7.2.1) elasticsearch-transport (7.5.0) faraday (>= 0.14, < 1) multi_json
Gemfile gem 'elasticsearch', '8.5.0' gem 'elasticsearch-api', '8.5.0' gem 'elasticsearch-model' gem 'elasticsearch-rails' Gemfile.lock elastic-transport (8.1.0) faraday (< 3) multi_json elasticsearch (8.5.0) elastic-transport (~> 8) elasticsearch-api (= 8.5.0) elasticsearch-api (8.5.0) multi_json elasticsearch-model (7.1.1) activesupport (> 3) elasticsearch (> 1) hashie elasticsearch-rails (7.2.1)
2.7.6 :001 > Car.__elasticsearch__.search({}).results.count ETHON: performed EASY effective_url=http://localhost:10005/cars/_search?type response_code=400 return_code=ok total_time=0.00252 curl -X POST -H 'Authorization: Basic Og==, x-elastic-client-meta: es=8.5.0,rb=2.7.6,t=8.1.0,fd=0.17.6,ty=1.4.0, User-Agent: elastic-transport-ruby/8.1.0 (RUBY_VERSION: 2.7.6; darwin x86_64; Faraday v0.17.6), Content-Type: application/json' 'http://localhost:9200/cars/_search?pretty&type' -d '{}' # 2022-11-24T12:35:04+01:00 [400] (0.004s) # # {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"request [/cars/_search] contains unrecognized parameter: [type]"}],"type":"illegal_argument_exception","reason":"request [/cars/_search] contains unrecognized parameter: [type]"},"status":400} Traceback (most recent call last): 2: from (irb):1 1: from (irb):1:in `count' Elastic::Transport::Transport::Errors::BadRequest ([400] {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"request [/cars/_search] contains unrecognized parameter: [type]"}],"type":"illegal_argument_exception","reason":"request [/cars/_search] contains unrecognized parameter: [type]"},"status":400})
type appears to be added here: https://github.com/elastic/elasticsearch-rails/blob/main/elasticsearch-model/lib/elasticsearch/model/searching.rb#L57-L59
type
However we can see here in the comments the allowed parameters does not allow type: https://github.com/elastic/elasticsearch-ruby/blob/main/elasticsearch-api/lib/elasticsearch/api/actions/search.rb#L26-L72
We need to start using ES Cloud ID and API key which, according to Elasticsearch support, is not supported in gems of 7.5 versions.
Damn. Also stucked with this problem in the middle of update of 'elasticsearch' gem and updating to Elasticsearch 8.7.0 :( Any solution/fork yet?
Aloha,
The ruby API gem, 'elasticsearch-api', alongside this gem seem to send a parameter on all requests when using 8.5 (also tested on 8.4 and 8.3).
At present I've got 7.5.0 in the Gemfile and all works as expected with an ES8.5 cluster.
Working
Kerploding
Example
type
appears to be added here: https://github.com/elastic/elasticsearch-rails/blob/main/elasticsearch-model/lib/elasticsearch/model/searching.rb#L57-L59However we can see here in the comments the allowed parameters does not allow
type
: https://github.com/elastic/elasticsearch-ruby/blob/main/elasticsearch-api/lib/elasticsearch/api/actions/search.rb#L26-L72Main reason for our upgrade
We need to start using ES Cloud ID and API key which, according to Elasticsearch support, is not supported in gems of 7.5 versions.