| 1 |
# Changes in Elastic 5.0 |
| 2 |
|
| 3 |
## Enforce context.Context in PerformRequest and Do |
| 4 |
|
| 5 |
We enforce the usage of `context.Context` everywhere you execute a request. |
| 6 |
You need to change all your `Do()` calls to pass a context: `Do(ctx)`. |
| 7 |
This enables automatic request cancelation and many other patterns. |
| 8 |
|
| 9 |
If you don't need this, simply pass `context.TODO()` or `context.Background()`. |
| 10 |
|
| 11 |
## Warmers removed |
| 12 |
|
| 13 |
Warmers are no longer necessary and have been [removed in ES 5.0](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_index_apis.html#_warmers). |
| 14 |
|
| 15 |
## Optimize removed |
| 16 |
|
| 17 |
Optimize was deprecated in ES 2.0 and has been [removed in ES 5.0](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_rest_api_changes.html#_literal__optimize_literal_endpoint_removed). |
| 18 |
Use [Force Merge](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-forcemerge.html) instead. |
| 19 |
|
| 20 |
## Missing Query removed |
| 21 |
|
| 22 |
The `missing` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/query-dsl-exists-query.html#_literal_missing_literal_query). |
| 23 |
Use `exists` query with `must_not` in `bool` query instead. |
| 24 |
|
| 25 |
## And Query removed |
| 26 |
|
| 27 |
The `and` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_search_changes.html#_deprecated_queries_removed). |
| 28 |
Use `must` clauses in a `bool` query instead. |
| 29 |
|
| 30 |
## Not Query removed |
| 31 |
|
| 32 |
TODO Is it removed? |
| 33 |
|
| 34 |
## Or Query removed |
| 35 |
|
| 36 |
The `or` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_search_changes.html#_deprecated_queries_removed). |
| 37 |
Use `should` clauses in a `bool` query instead. |
| 38 |
|
| 39 |
## Filtered Query removed |
| 40 |
|
| 41 |
The `filtered` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_search_changes.html#_deprecated_queries_removed). |
| 42 |
Use `bool` query instead, which supports `filter` clauses too. |
| 43 |
|
| 44 |
## Limit Query removed |
| 45 |
|
| 46 |
The `limit` query has been [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_search_changes.html#_deprecated_queries_removed). |
| 47 |
Use the `terminate_after` parameter instead. |
| 48 |
|
| 49 |
# Template Query removed |
| 50 |
|
| 51 |
The `template` query has been [deprecated](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/query-dsl-template-query.html). You should use |
| 52 |
Search Templates instead. |
| 53 |
|
| 54 |
We remove it from Elastic 5.0 as the 5.0 update is already a good opportunity |
| 55 |
to get rid of old stuff. |
| 56 |
|
| 57 |
## `_timestamp` and `_ttl` removed |
| 58 |
|
| 59 |
Both of these fields were deprecated and are now [removed](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_mapping_changes.html#_literal__timestamp_literal_and_literal__ttl_literal). |
| 60 |
|
| 61 |
## Search template Put/Delete API returns `acknowledged` only |
| 62 |
|
| 63 |
The response type for Put/Delete search templates has changed. |
| 64 |
It only returns a single `acknowledged` flag now. |
| 65 |
|
| 66 |
## Fields has been renamed to Stored Fields |
| 67 |
|
| 68 |
The `fields` parameter has been renamed to `stored_fields`. |
| 69 |
See [here](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/breaking_50_search_changes.html#_literal_fields_literal_parameter). |
| 70 |
|
| 71 |
## Fielddatafields has been renamed to Docvaluefields |
| 72 |
|
| 73 |
The `fielddata_fields` parameter [has been renamed](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/breaking_50_search_changes.html#_literal_fielddata_fields_literal_parameter) |
| 74 |
to `docvalue_fields`. |
| 75 |
|
| 76 |
## Type exists endpoint changed |
| 77 |
|
| 78 |
The endpoint for checking whether a type exists has been changed from |
| 79 |
`HEAD {index}/{type}` to `HEAD {index}/_mapping/{type}`. |
| 80 |
See [here](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/breaking_50_rest_api_changes.html#_literal_head_index_type_literal_replaced_with_literal_head_index__mapping_type_literal). |
| 81 |
|
| 82 |
## Refresh parameter changed |
| 83 |
|
| 84 |
The `?refresh` parameter previously could be a boolean value. It indicated |
| 85 |
whether changes made by a request (e.g. by the Bulk API) should be immediately |
| 86 |
visible in search, or not. Using `refresh=true` had the positive effect of |
| 87 |
immediately seeing the changes when searching; the negative effect is that |
| 88 |
it is a rather big performance hit. |
| 89 |
|
| 90 |
With 5.0, you now have the choice between these 3 values. |
| 91 |
|
| 92 |
* `"true"` - Refresh immediately |
| 93 |
* `"false"` - Do not refresh (the default value) |
| 94 |
* `"wait_for"` - Wait until ES made the document visible in search |
| 95 |
|
| 96 |
See [?refresh](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-refresh.html) in the documentation. |
| 97 |
|
| 98 |
Notice that `true` and `false` (the boolean values) are no longer available |
| 99 |
now in Elastic. You must use a string instead, with one of the above values. |
| 100 |
|
| 101 |
## ReindexerService removed |
| 102 |
|
| 103 |
The `ReindexerService` was a custom solution that was started in the ES 1.x era |
| 104 |
to automate reindexing data, from one index to another or even between clusters. |
| 105 |
|
| 106 |
ES 2.3 introduced its own [Reindex API](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-reindex.html) |
| 107 |
so we're going to remove our custom solution and ask you to use the native reindexer. |
| 108 |
|
| 109 |
The `ReindexService` is available via `client.Reindex()` (which used to point |
| 110 |
to the custom reindexer). |
| 111 |
|
| 112 |
## Delete By Query back in core |
| 113 |
|
| 114 |
The [Delete By Query API](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-delete-by-query.html) |
| 115 |
was moved into a plugin in 2.0. Now its back in core with a complete rewrite based on the Bulk API. |
| 116 |
|
| 117 |
It has it's own endpoint at `/_delete_by_query`. |
| 118 |
|
| 119 |
Delete By Query, Reindex, and Update By Query are very similar under the hood. |
| 120 |
|
| 121 |
## Reindex, Delete By Query, and Update By Query response changed |
| 122 |
|
| 123 |
The response from the above APIs changed a bit. E.g. the `retries` value |
| 124 |
used to be an `int64` and returns separate values for `bulk` and `search` now: |
| 125 |
|
| 126 |
``` |
| 127 |
// Old |
| 128 |
{ |
| 129 |
... |
| 130 |
"retries": 123, |
| 131 |
... |
| 132 |
} |
| 133 |
``` |
| 134 |
|
| 135 |
``` |
| 136 |
// New |
| 137 |
{ |
| 138 |
... |
| 139 |
"retries": { |
| 140 |
"bulk": 123, |
| 141 |
"search": 0 |
| 142 |
}, |
| 143 |
... |
| 144 |
} |
| 145 |
``` |
| 146 |
|
| 147 |
## ScanService removed |
| 148 |
|
| 149 |
The `ScanService` is removed. Use the (new) `ScrollService` instead. |
| 150 |
|
| 151 |
## New ScrollService |
| 152 |
|
| 153 |
There was confusion around `ScanService` and `ScrollService` doing basically |
| 154 |
the same. One was returning slices and didn't support all query details, the |
| 155 |
other returned one document after another and wasn't safe for concurrent use. |
| 156 |
So we merged the two and merged it into a new `ScrollService` that |
| 157 |
removes all the problems with the older services. |
| 158 |
|
| 159 |
In other words: |
| 160 |
If you used `ScanService`, switch to `ScrollService`. |
| 161 |
If you used the old `ScrollService`, you might need to fix some things but |
| 162 |
overall it should just work. |
| 163 |
|
| 164 |
Changes: |
| 165 |
- We replaced `elastic.EOS` with `io.EOF` to indicate the "end of scroll". |
| 166 |
|
| 167 |
TODO Not implemented yet |
| 168 |
|
| 169 |
## Suggesters |
| 170 |
|
| 171 |
They have been [completely rewritten in ES 5.0](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_suggester.html). |
| 172 |
|
| 173 |
Some changes: |
| 174 |
- Suggesters no longer have an [output](https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_50_suggester.html#_simpler_completion_indexing). |
| 175 |
|
| 176 |
TODO Fix all structural changes in suggesters |
| 177 |
|
| 178 |
## Percolator |
| 179 |
|
| 180 |
Percolator has [changed considerably](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/breaking_50_percolator.html). |
| 181 |
|
| 182 |
Elastic 5.0 adds the new |
| 183 |
[Percolator Query](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/query-dsl-percolate-query.html) |
| 184 |
which can be used in combination with the new |
| 185 |
[Percolator type](https://www.elastic.co/guide/en/elasticsearch/reference/5.x/percolator.html). |
| 186 |
|
| 187 |
The Percolate service is removed from Elastic 5.0. |
| 188 |
|
| 189 |
## Remove Consistency, add WaitForActiveShards |
| 190 |
|
| 191 |
The `consistency` parameter has been removed in a lot of places, e.g. the Bulk, |
| 192 |
Index, Delete, Delete-by-Query, Reindex, Update, and Update-by-Query API. |
| 193 |
|
| 194 |
It has been replaced by a somewhat similar `wait_for_active_shards` parameter. |
| 195 |
See https://github.com/elastic/elasticsearch/pull/19454. |