From 78f1a13a891e9197d09c1f0ed011a08b408e895d Mon Sep 17 00:00:00 2001 From: Andrew Date: Wed, 28 Feb 2018 23:52:46 -0800 Subject: [PATCH] Added section on Elasticsearch 5 to 6 upgrade [skip ci] --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+), 0 deletions(-) diff --git a/README.md b/README.md index 0190392..003dcde 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ Plus: - [Elasticsearch DSL](#advanced) - [Reference](#reference) +Thinking of upgrading from Elasticsearch 5 to 6? [Read this first](#elasticsearch-5-to-6-upgrade) + ## Getting Started [Install Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html). For Homebrew, use: @@ -1909,6 +1911,28 @@ If running Searchkick `0.6.0` or `0.7.0` and Elasticsearch `0.90`, we recommend Before `0.3.0`, locations were indexed incorrectly. When upgrading, be sure to reindex immediately. +## Elasticsearch 5 to 6 Upgrade + +Elasticsearch 6 removes the ability to reindex with the `_all` field. Before you upgrade, we recommend disabling this field manually and specifying default fields on your models. + +```ruby +class Product < ApplicationRecord + searchkick _all: false, default_fields: [:name] +end +``` + +If you need search across fields (which the `_all` field allowed), we recommend creating a similar field in your search data. + +```ruby +class Product < ApplicationRecord + def search_data + { + all: [name, size, quantity].join(" ") + } + end +end +``` + ## Elasticsearch Gotchas ### Consistency -- libgit2 0.21.0