Commit dee94765951bf0a9afdb120db383c2dd344ecfbb

Authored by Andrew
1 parent 076a2dba

Added tests and fixes for Elasticsearch 6

.travis.yml
1 1 sudo: false
2 2 language: ruby
3   -rvm: 2.3.1
  3 +rvm: 2.4.2
4 4 services:
5 5 - mongodb
6 6 - redis-server
... ... @@ -20,7 +20,7 @@ gemfile:
20 20 - test/gemfiles/mongoid5.gemfile
21 21 - test/gemfiles/mongoid6.gemfile
22 22 env:
23   - - ELASTICSEARCH_VERSION=5.6.0
  23 + - ELASTICSEARCH_VERSION=6.0.0
24 24 jdk: oraclejdk8
25 25 matrix:
26 26 include:
... ... @@ -28,12 +28,11 @@ matrix:
28 28 env: ELASTICSEARCH_VERSION=2.0.0
29 29 jdk: oraclejdk7
30 30 - gemfile: Gemfile
31   - env: ELASTICSEARCH_VERSION=2.4.3
  31 + env: ELASTICSEARCH_VERSION=2.4.6
32 32 jdk: oraclejdk7
33 33 - gemfile: Gemfile
34 34 env: ELASTICSEARCH_VERSION=5.0.1
35 35 jdk: oraclejdk8
36   - allow_failures:
37 36 - gemfile: Gemfile
38   - env: ELASTICSEARCH_VERSION=6.0.0-beta1
  37 + env: ELASTICSEARCH_VERSION=5.6.4
39 38 jdk: oraclejdk8
... ...
CHANGELOG.md
  1 +## 2.3.3 [unreleased]
  2 +
  3 +- Fixed `similar` for Elasticsearch 6
  4 +
1 5 ## 2.3.2
2 6  
3 7 - Added `_all` and `default_fields` options
... ...
lib/searchkick/query.rb
... ... @@ -233,7 +233,7 @@ module Searchkick
233 233 if options[:similar]
234 234 payload = {
235 235 more_like_this: {
236   - like_text: term,
  236 + like: term,
237 237 min_doc_freq: 1,
238 238 min_term_freq: 1,
239 239 analyzer: "searchkick_search2"
... ... @@ -515,6 +515,8 @@ module Searchkick
515 515 ["_all"]
516 516 elsif all && default_match == :phrase
517 517 ["_all.phrase"]
  518 + elsif term == "*"
  519 + []
518 520 else
519 521 raise ArgumentError, "Must specify fields to search"
520 522 end
... ...
test/inheritance_test.rb
... ... @@ -2,7 +2,7 @@ require_relative "test_helper"
2 2  
3 3 class InheritanceTest < Minitest::Test
4 4 def setup
5   - skip if defined?(Cequel)
  5 + skip if defined?(Cequel) || !elasticsearch_below60?
6 6 super
7 7 end
8 8  
... ...