Commit 384b47969b740113f18ed9d6e446c2e7ab726bcd
Exists in
master
and in
2 other branches
Merge branch 'master' into edge
Showing
2 changed files
with
23 additions
and
23 deletions
Show diff stats
.github/workflows/build.yml
... | ... | @@ -8,16 +8,16 @@ jobs: |
8 | 8 | include: |
9 | 9 | - ruby: 3.1 |
10 | 10 | gemfile: Gemfile |
11 | - elasticsearch: 7.16.3 | |
11 | + elasticsearch: 8.0.0 | |
12 | 12 | - ruby: 3.1 |
13 | 13 | gemfile: gemfiles/opensearch.gemfile |
14 | - opensearch: 1.2.3 | |
14 | + opensearch: 1.2.4 | |
15 | 15 | - ruby: "3.0" |
16 | 16 | gemfile: gemfiles/activerecord61.gemfile |
17 | - elasticsearch: 7.16.3 | |
17 | + elasticsearch: 7.17.0 | |
18 | 18 | - ruby: 2.7 |
19 | 19 | gemfile: gemfiles/activerecord60.gemfile |
20 | - elasticsearch: 7.16.3 | |
20 | + elasticsearch: 7.17.0 | |
21 | 21 | - ruby: 2.6 |
22 | 22 | gemfile: gemfiles/activerecord52.gemfile |
23 | 23 | elasticsearch: 7.0.0 | ... | ... |
README.md
... | ... | @@ -39,7 +39,7 @@ Check out [Searchjoy](https://github.com/ankane/searchjoy) for analytics and [Au |
39 | 39 | - [Testing](#testing) |
40 | 40 | - [Deployment](#deployment) |
41 | 41 | - [Performance](#performance) |
42 | -- [Elasticsearch DSL](#advanced) | |
42 | +- [Advanced Search](#advanced) | |
43 | 43 | - [Reference](#reference) |
44 | 44 | - [Contributing](#contributing) |
45 | 45 | |
... | ... | @@ -156,7 +156,7 @@ results.any? |
156 | 156 | results.each { |result| ... } |
157 | 157 | ``` |
158 | 158 | |
159 | -By default, ids are fetched from Elasticsearch and records are fetched from your database. To fetch everything from Elasticsearch, use: | |
159 | +By default, ids are fetched from the search server and records are fetched from your database. To fetch everything from the search server, use: | |
160 | 160 | |
161 | 161 | ```ruby |
162 | 162 | Product.search("apples", load: false) |
... | ... | @@ -174,13 +174,13 @@ Get the time the search took (in milliseconds) |
174 | 174 | results.took |
175 | 175 | ``` |
176 | 176 | |
177 | -Get the full response from Elasticsearch | |
177 | +Get the full response from the search server | |
178 | 178 | |
179 | 179 | ```ruby |
180 | 180 | results.response |
181 | 181 | ``` |
182 | 182 | |
183 | -**Note:** By default, Elasticsearch [limits paging](#deep-paging) to the first 10,000 results for performance. With Elasticsearch 7, this applies to the total count as well. | |
183 | +**Note:** By default, Elasticsearch and OpenSearch [limit paging](#deep-paging) to the first 10,000 results for performance. With Elasticsearch 7 and OpenSearch, this applies to the total count as well. | |
184 | 184 | |
185 | 185 | ### Boosting |
186 | 186 | |
... | ... | @@ -378,9 +378,9 @@ search_synonyms: ["lightbulb => halogenlamp"] |
378 | 378 | |
379 | 379 | The above approach works well when your synonym list is static, but in practice, this is often not the case. When you analyze search conversions, you often want to add new synonyms without a full reindex. |
380 | 380 | |
381 | -#### Elasticsearch 7.3+ or OpenSearch | |
381 | +#### Elasticsearch 7.3+ and OpenSearch | |
382 | 382 | |
383 | -For Elasticsearch 7.3+ or OpenSearch, we recommend placing synonyms in a file on the Elasticsearch or OpenSearch server (in the `config` directory). This allows you to reload synonyms without reindexing. | |
383 | +For Elasticsearch 7.3+ and OpenSearch, we recommend placing synonyms in a file on the search server (in the `config` directory). This allows you to reload synonyms without reindexing. | |
384 | 384 | |
385 | 385 | ```txt |
386 | 386 | pop, soda |
... | ... | @@ -1046,13 +1046,13 @@ Product.search("soap", debug: true) |
1046 | 1046 | |
1047 | 1047 | This prints useful info to `stdout`. |
1048 | 1048 | |
1049 | -See how Elasticsearch scores your queries with: | |
1049 | +See how the search server scores your queries with: | |
1050 | 1050 | |
1051 | 1051 | ```ruby |
1052 | 1052 | Product.search("soap", explain: true).response |
1053 | 1053 | ``` |
1054 | 1054 | |
1055 | -See how Elasticsearch tokenizes your queries with: | |
1055 | +See how the search server tokenizes your queries with: | |
1056 | 1056 | |
1057 | 1057 | ```ruby |
1058 | 1058 | Product.search_index.tokens("Dish Washer Soap", analyzer: "searchkick_index") |
... | ... | @@ -1226,7 +1226,7 @@ And [setup-opensearch](https://github.com/ankane/setup-opensearch) for an easy w |
1226 | 1226 | |
1227 | 1227 | ## Deployment |
1228 | 1228 | |
1229 | -Searchkick uses `ENV["ELASTICSEARCH_URL"]` for the Elasticsearch server. This defaults to `http://localhost:9200`. | |
1229 | +Searchkick uses `ENV["ELASTICSEARCH_URL"]` for the search server. This defaults to `http://localhost:9200`. | |
1230 | 1230 | |
1231 | 1231 | - [Elastic Cloud](#elastic-cloud) |
1232 | 1232 | - [Heroku](#heroku) |
... | ... | @@ -1336,9 +1336,9 @@ rake searchkick:reindex:all |
1336 | 1336 | |
1337 | 1337 | ### Data Protection |
1338 | 1338 | |
1339 | -We recommend encrypting data at rest and in transit (even inside your own network). This is especially important if you send [personal data](https://en.wikipedia.org/wiki/Personally_identifiable_information) of your users to Elasticsearch. | |
1339 | +We recommend encrypting data at rest and in transit (even inside your own network). This is especially important if you send [personal data](https://en.wikipedia.org/wiki/Personally_identifiable_information) of your users to the search server. | |
1340 | 1340 | |
1341 | -Bonsai, Elastic Cloud, and Amazon Elasticsearch all support encryption at rest and HTTPS. | |
1341 | +Bonsai, Elastic Cloud, and Amazon OpenSearch Service all support encryption at rest and HTTPS. | |
1342 | 1342 | |
1343 | 1343 | ### Automatic Failover |
1344 | 1344 | |
... | ... | @@ -1513,7 +1513,7 @@ For more tips, check out [Keeping Elasticsearch in Sync](https://www.elastic.co/ |
1513 | 1513 | |
1514 | 1514 | ### Routing |
1515 | 1515 | |
1516 | -Searchkick supports [Elasticsearch’s routing feature](https://www.elastic.co/blog/customizing-your-document-routing), which can significantly speed up searches. | |
1516 | +Searchkick supports [routing](https://www.elastic.co/blog/customizing-your-document-routing), which can significantly speed up searches. | |
1517 | 1517 | |
1518 | 1518 | ```ruby |
1519 | 1519 | class Business < ApplicationRecord |
... | ... | @@ -1675,7 +1675,7 @@ products = |
1675 | 1675 | end |
1676 | 1676 | ``` |
1677 | 1677 | |
1678 | -### Elasticsearch Gem | |
1678 | +### Client | |
1679 | 1679 | |
1680 | 1680 | Searchkick is built on top of the [elasticsearch](https://github.com/elastic/elasticsearch-ruby) gem. To access the client directly, use: |
1681 | 1681 | |
... | ... | @@ -1740,7 +1740,7 @@ products.clear_scroll |
1740 | 1740 | |
1741 | 1741 | ## Deep Paging |
1742 | 1742 | |
1743 | -By default, Elasticsearch limits paging to the first 10,000 results. [Here’s why](https://www.elastic.co/guide/en/elasticsearch/guide/current/pagination.html). We don’t recommend changing this, but if you really need all results, you can use: | |
1743 | +By default, Elasticsearch and OpenSearch limit paging to the first 10,000 results. [Here’s why](https://www.elastic.co/guide/en/elasticsearch/guide/current/pagination.html). We don’t recommend changing this, but if you really need all results, you can use: | |
1744 | 1744 | |
1745 | 1745 | ```ruby |
1746 | 1746 | class Product < ApplicationRecord |
... | ... | @@ -1748,7 +1748,7 @@ class Product < ApplicationRecord |
1748 | 1748 | end |
1749 | 1749 | ``` |
1750 | 1750 | |
1751 | -If you just need an accurate total count with Elasticsearch 7, you can instead use: | |
1751 | +If you just need an accurate total count with Elasticsearch 7 and OpenSearch, you can instead use: | |
1752 | 1752 | |
1753 | 1753 | ```ruby |
1754 | 1754 | Product.search("pears", body_options: {track_total_hits: true}) |
... | ... | @@ -2000,7 +2000,7 @@ Turn on misspellings after a certain number of characters |
2000 | 2000 | Product.search "api", misspellings: {prefix_length: 2} # api, apt, no ahi |
2001 | 2001 | ``` |
2002 | 2002 | |
2003 | -**Note:** With this option, if the query length is the same as `prefix_length`, misspellings are turned off | |
2003 | +**Note:** With this option, if the query length is the same as `prefix_length`, misspellings are turned off with Elasticsearch 7 and OpenSearch | |
2004 | 2004 | |
2005 | 2005 | ```ruby |
2006 | 2006 | Product.search "ah", misspellings: {prefix_length: 2} # ah, no aha |
... | ... | @@ -2011,11 +2011,11 @@ Product.search "ah", misspellings: {prefix_length: 2} # ah, no aha |
2011 | 2011 | 1. Install Searchkick 4 |
2012 | 2012 | 2. Upgrade your Elasticsearch cluster |
2013 | 2013 | |
2014 | -## Elasticsearch Gotchas | |
2014 | +## Gotchas | |
2015 | 2015 | |
2016 | 2016 | ### Consistency |
2017 | 2017 | |
2018 | -Elasticsearch is eventually consistent, meaning it can take up to a second for a change to reflect in search. You can use the `refresh` method to have it show up immediately. | |
2018 | +Elasticsearch and OpenSearch are eventually consistent, meaning it can take up to a second for a change to reflect in search. You can use the `refresh` method to have it show up immediately. | |
2019 | 2019 | |
2020 | 2020 | ```ruby |
2021 | 2021 | product.save! |
... | ... | @@ -2024,7 +2024,7 @@ Product.search_index.refresh |
2024 | 2024 | |
2025 | 2025 | ### Inconsistent Scores |
2026 | 2026 | |
2027 | -Due to the distributed nature of Elasticsearch, you can get incorrect results when the number of documents in the index is low. You can [read more about it here](https://www.elastic.co/blog/understanding-query-then-fetch-vs-dfs-query-then-fetch). To fix this, do: | |
2027 | +Due to the distributed nature of Elasticsearch and OpenSearch, you can get incorrect results when the number of documents in the index is low. You can [read more about it here](https://www.elastic.co/blog/understanding-query-then-fetch-vs-dfs-query-then-fetch). To fix this, do: | |
2028 | 2028 | |
2029 | 2029 | ```ruby |
2030 | 2030 | class Product < ApplicationRecord | ... | ... |