Commit 78f1a13a891e9197d09c1f0ed011a08b408e895d

Authored by Andrew
1 parent ba33a8e3

Added section on Elasticsearch 5 to 6 upgrade [skip ci]

Showing 1 changed file with 24 additions and 0 deletions   Show diff stats
README.md
... ... @@ -39,6 +39,8 @@ Plus:
39 39 - [Elasticsearch DSL](#advanced)
40 40 - [Reference](#reference)
41 41  
  42 +Thinking of upgrading from Elasticsearch 5 to 6? [Read this first](#elasticsearch-5-to-6-upgrade)
  43 +
42 44 ## Getting Started
43 45  
44 46 [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
1909 1911  
1910 1912 Before `0.3.0`, locations were indexed incorrectly. When upgrading, be sure to reindex immediately.
1911 1913  
  1914 +## Elasticsearch 5 to 6 Upgrade
  1915 +
  1916 +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.
  1917 +
  1918 +```ruby
  1919 +class Product < ApplicationRecord
  1920 + searchkick _all: false, default_fields: [:name]
  1921 +end
  1922 +```
  1923 +
  1924 +If you need search across fields (which the `_all` field allowed), we recommend creating a similar field in your search data.
  1925 +
  1926 +```ruby
  1927 +class Product < ApplicationRecord
  1928 + def search_data
  1929 + {
  1930 + all: [name, size, quantity].join(" ")
  1931 + }
  1932 + end
  1933 +end
  1934 +```
  1935 +
1912 1936 ## Elasticsearch Gotchas
1913 1937  
1914 1938 ### Consistency
... ...