Commit fce604c845717387189c69d3530fcda493f9cfd5
1 parent
d8ce46d4
Exists in
master
and in
19 other branches
Added section on consistency - closes #856
Showing
1 changed file
with
9 additions
and
0 deletions
Show diff stats
README.md
@@ -1770,6 +1770,15 @@ Before `0.3.0`, locations were indexed incorrectly. When upgrading, be sure to r | @@ -1770,6 +1770,15 @@ Before `0.3.0`, locations were indexed incorrectly. When upgrading, be sure to r | ||
1770 | 1770 | ||
1771 | ## Elasticsearch Gotchas | 1771 | ## Elasticsearch Gotchas |
1772 | 1772 | ||
1773 | +### Consistency | ||
1774 | + | ||
1775 | +Elasticsearch is eventually consistent, which means 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. | ||
1776 | + | ||
1777 | +```ruby | ||
1778 | +product.save! | ||
1779 | +Product.search_index.refresh | ||
1780 | +``` | ||
1781 | + | ||
1773 | ### Inconsistent Scores | 1782 | ### Inconsistent Scores |
1774 | 1783 | ||
1775 | 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: | 1784 | 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: |