Commit b17c8d037367232dd557bd8e0551bd6aabc67307

Authored by Andrew Kane
1 parent 12450852

Include OpenSearch with Elasticsearch references [skip ci]

Showing 1 changed file with 19 additions and 19 deletions   Show diff stats
@@ -39,7 +39,7 @@ Check out [Searchjoy](https://github.com/ankane/searchjoy) for analytics and [Au @@ -39,7 +39,7 @@ Check out [Searchjoy](https://github.com/ankane/searchjoy) for analytics and [Au
39 - [Testing](#testing) 39 - [Testing](#testing)
40 - [Deployment](#deployment) 40 - [Deployment](#deployment)
41 - [Performance](#performance) 41 - [Performance](#performance)
42 -- [Elasticsearch DSL](#advanced) 42 +- [Advanced Search](#advanced)
43 - [Reference](#reference) 43 - [Reference](#reference)
44 - [Contributing](#contributing) 44 - [Contributing](#contributing)
45 45
@@ -153,7 +153,7 @@ results.any? @@ -153,7 +153,7 @@ results.any?
153 results.each { |result| ... } 153 results.each { |result| ... }
154 ``` 154 ```
155 155
156 -By default, ids are fetched from Elasticsearch and records are fetched from your database. To fetch everything from Elasticsearch, use: 156 +By default, ids are fetched from the search server and records are fetched from your database. To fetch everything from the search server, use:
157 157
158 ```ruby 158 ```ruby
159 Product.search("apples", load: false) 159 Product.search("apples", load: false)
@@ -171,13 +171,13 @@ Get the time the search took (in milliseconds) @@ -171,13 +171,13 @@ Get the time the search took (in milliseconds)
171 results.took 171 results.took
172 ``` 172 ```
173 173
174 -Get the full response from Elasticsearch 174 +Get the full response from the search server
175 175
176 ```ruby 176 ```ruby
177 results.response 177 results.response
178 ``` 178 ```
179 179
180 -**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. 180 +**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.
181 181
182 ### Boosting 182 ### Boosting
183 183
@@ -375,9 +375,9 @@ search_synonyms: ["lightbulb => halogenlamp"] @@ -375,9 +375,9 @@ search_synonyms: ["lightbulb => halogenlamp"]
375 375
376 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. 376 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.
377 377
378 -#### Elasticsearch 7.3+ or OpenSearch 378 +#### Elasticsearch 7.3+ and OpenSearch
379 379
380 -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. 380 +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.
381 381
382 ```txt 382 ```txt
383 pop, soda 383 pop, soda
@@ -1043,13 +1043,13 @@ Product.search("soap", debug: true) @@ -1043,13 +1043,13 @@ Product.search("soap", debug: true)
1043 1043
1044 This prints useful info to `stdout`. 1044 This prints useful info to `stdout`.
1045 1045
1046 -See how Elasticsearch scores your queries with: 1046 +See how the search server scores your queries with:
1047 1047
1048 ```ruby 1048 ```ruby
1049 Product.search("soap", explain: true).response 1049 Product.search("soap", explain: true).response
1050 ``` 1050 ```
1051 1051
1052 -See how Elasticsearch tokenizes your queries with: 1052 +See how the search server tokenizes your queries with:
1053 1053
1054 ```ruby 1054 ```ruby
1055 Product.search_index.tokens("Dish Washer Soap", analyzer: "searchkick_index") 1055 Product.search_index.tokens("Dish Washer Soap", analyzer: "searchkick_index")
@@ -1223,7 +1223,7 @@ And [setup-opensearch](https://github.com/ankane/setup-opensearch) for an easy w @@ -1223,7 +1223,7 @@ And [setup-opensearch](https://github.com/ankane/setup-opensearch) for an easy w
1223 1223
1224 ## Deployment 1224 ## Deployment
1225 1225
1226 -Searchkick uses `ENV["ELASTICSEARCH_URL"]` for the Elasticsearch server. This defaults to `http://localhost:9200`. 1226 +Searchkick uses `ENV["ELASTICSEARCH_URL"]` for the search server. This defaults to `http://localhost:9200`.
1227 1227
1228 - [Elastic Cloud](#elastic-cloud) 1228 - [Elastic Cloud](#elastic-cloud)
1229 - [Heroku](#heroku) 1229 - [Heroku](#heroku)
@@ -1333,9 +1333,9 @@ rake searchkick:reindex:all @@ -1333,9 +1333,9 @@ rake searchkick:reindex:all
1333 1333
1334 ### Data Protection 1334 ### Data Protection
1335 1335
1336 -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. 1336 +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.
1337 1337
1338 -Bonsai, Elastic Cloud, and Amazon Elasticsearch all support encryption at rest and HTTPS. 1338 +Bonsai, Elastic Cloud, and Amazon OpenSearch Service all support encryption at rest and HTTPS.
1339 1339
1340 ### Automatic Failover 1340 ### Automatic Failover
1341 1341
@@ -1510,7 +1510,7 @@ For more tips, check out [Keeping Elasticsearch in Sync](https://www.elastic.co/ @@ -1510,7 +1510,7 @@ For more tips, check out [Keeping Elasticsearch in Sync](https://www.elastic.co/
1510 1510
1511 ### Routing 1511 ### Routing
1512 1512
1513 -Searchkick supports [Elasticsearch’s routing feature](https://www.elastic.co/blog/customizing-your-document-routing), which can significantly speed up searches. 1513 +Searchkick supports [routing](https://www.elastic.co/blog/customizing-your-document-routing), which can significantly speed up searches.
1514 1514
1515 ```ruby 1515 ```ruby
1516 class Business < ApplicationRecord 1516 class Business < ApplicationRecord
@@ -1672,7 +1672,7 @@ products = @@ -1672,7 +1672,7 @@ products =
1672 end 1672 end
1673 ``` 1673 ```
1674 1674
1675 -### Elasticsearch Gem 1675 +### Client
1676 1676
1677 Searchkick is built on top of the [elasticsearch](https://github.com/elastic/elasticsearch-ruby) gem. To access the client directly, use: 1677 Searchkick is built on top of the [elasticsearch](https://github.com/elastic/elasticsearch-ruby) gem. To access the client directly, use:
1678 1678
@@ -1737,7 +1737,7 @@ products.clear_scroll @@ -1737,7 +1737,7 @@ products.clear_scroll
1737 1737
1738 ## Deep Paging 1738 ## Deep Paging
1739 1739
1740 -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: 1740 +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:
1741 1741
1742 ```ruby 1742 ```ruby
1743 class Product < ApplicationRecord 1743 class Product < ApplicationRecord
@@ -1745,7 +1745,7 @@ class Product &lt; ApplicationRecord @@ -1745,7 +1745,7 @@ class Product &lt; ApplicationRecord
1745 end 1745 end
1746 ``` 1746 ```
1747 1747
1748 -If you just need an accurate total count with Elasticsearch 7, you can instead use: 1748 +If you just need an accurate total count with Elasticsearch 7 and OpenSearch, you can instead use:
1749 1749
1750 ```ruby 1750 ```ruby
1751 Product.search("pears", body_options: {track_total_hits: true}) 1751 Product.search("pears", body_options: {track_total_hits: true})
@@ -2004,7 +2004,7 @@ Turn on misspellings after a certain number of characters @@ -2004,7 +2004,7 @@ Turn on misspellings after a certain number of characters
2004 Product.search "api", misspellings: {prefix_length: 2} # api, apt, no ahi 2004 Product.search "api", misspellings: {prefix_length: 2} # api, apt, no ahi
2005 ``` 2005 ```
2006 2006
2007 -**Note:** With this option, if the query length is the same as `prefix_length`, misspellings are turned off 2007 +**Note:** With this option, if the query length is the same as `prefix_length`, misspellings are turned off with Elasticsearch 7 and OpenSearch
2008 2008
2009 ```ruby 2009 ```ruby
2010 Product.search "ah", misspellings: {prefix_length: 2} # ah, no aha 2010 Product.search "ah", misspellings: {prefix_length: 2} # ah, no aha
@@ -2015,11 +2015,11 @@ Product.search &quot;ah&quot;, misspellings: {prefix_length: 2} # ah, no aha @@ -2015,11 +2015,11 @@ Product.search &quot;ah&quot;, misspellings: {prefix_length: 2} # ah, no aha
2015 1. Install Searchkick 4 2015 1. Install Searchkick 4
2016 2. Upgrade your Elasticsearch cluster 2016 2. Upgrade your Elasticsearch cluster
2017 2017
2018 -## Elasticsearch Gotchas 2018 +## Gotchas
2019 2019
2020 ### Consistency 2020 ### Consistency
2021 2021
2022 -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. 2022 +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.
2023 2023
2024 ```ruby 2024 ```ruby
2025 product.save! 2025 product.save!
@@ -2028,7 +2028,7 @@ Product.search_index.refresh @@ -2028,7 +2028,7 @@ Product.search_index.refresh
2028 2028
2029 ### Inconsistent Scores 2029 ### Inconsistent Scores
2030 2030
2031 -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: 2031 +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:
2032 2032
2033 ```ruby 2033 ```ruby
2034 class Product < ApplicationRecord 2034 class Product < ApplicationRecord