We enforce the usage of context.Context
everywhere you execute a request.
You need to change all your Do()
calls to pass a context: Do(ctx)
.
This enables automatic request cancelation and many other patterns.
If you don't need this, simply pass context.TODO()
or context.Background()
.
Warmers are no longer necessary and have been removed in ES 5.0.
Optimize was deprecated in ES 2.0 and has been removed in ES 5.0. Use Force Merge instead.
The missing
query has been removed.
Use exists
query with must_not
in bool
query instead.
The and
query has been removed.
Use must
clauses in a bool
query instead.
TODO Is it removed?
The or
query has been removed.
Use should
clauses in a bool
query instead.
The filtered
query has been removed.
Use bool
query instead, which supports filter
clauses too.
The limit
query has been removed.
Use the terminate_after
parameter instead.
The template
query has been deprecated. You should use
Search Templates instead.
We remove it from Elastic 5.0 as the 5.0 update is already a good opportunity to get rid of old stuff.
Both of these fields were deprecated and are now removed.
The response type for Put/Delete search templates has changed.
It only returns a single acknowledged
flag now.
The fields
parameter has been renamed to stored_fields
.
See here.
The fielddata_fields
parameter has been renamed
to docvalue_fields
.
The endpoint for checking whether a type exists has been changed from
HEAD {index}/{type}
to HEAD {index}/_mapping/{type}
.
See here.
The ?refresh
parameter previously could be a boolean value. It indicated
whether changes made by a request (e.g. by the Bulk API) should be immediately
visible in search, or not. Using refresh=true
had the positive effect of
immediately seeing the changes when searching; the negative effect is that
it is a rather big performance hit.
With 5.0, you now have the choice between these 3 values.
"true"
- Refresh immediately"false"
- Do not refresh (the default value)"wait_for"
- Wait until ES made the document visible in search
See ?refresh in the documentation.
Notice that true
and false
(the boolean values) are no longer available
now in Elastic. You must use a string instead, with one of the above values.
The ReindexerService
was a custom solution that was started in the ES 1.x era
to automate reindexing data, from one index to another or even between clusters.
ES 2.3 introduced its own Reindex API so we're going to remove our custom solution and ask you to use the native reindexer.
The ReindexService
is available via client.Reindex()
(which used to point
to the custom reindexer).
The Delete By Query API was moved into a plugin in 2.0. Now its back in core with a complete rewrite based on the Bulk API.
It has it's own endpoint at /_delete_by_query
.
Delete By Query, Reindex, and Update By Query are very similar under the hood.
The response from the above APIs changed a bit. E.g. the retries
value
used to be an int64
and returns separate values for bulk
and search
now:
// Old
{
...
"retries": 123,
...
}
// New
{
...
"retries": {
"bulk": 123,
"search": 0
},
...
}
The ScanService
is removed. Use the (new) ScrollService
instead.
There was confusion around ScanService
and ScrollService
doing basically
the same. One was returning slices and didn't support all query details, the
other returned one document after another and wasn't safe for concurrent use.
So we merged the two and merged it into a new ScrollService
that
removes all the problems with the older services.
In other words:
If you used ScanService
, switch to ScrollService
.
If you used the old ScrollService
, you might need to fix some things but
overall it should just work.
Changes:
- We replaced
elastic.EOS
withio.EOF
to indicate the "end of scroll".
TODO Not implemented yet
They have been completely rewritten in ES 5.0.
Some changes:
- Suggesters no longer have an output.
TODO Fix all structural changes in suggesters
Percolator has changed considerably.
Elastic 5.0 adds the new Percolator Query which can be used in combination with the new Percolator type.
The Percolate service is removed from Elastic 5.0.
The consistency
parameter has been removed in a lot of places, e.g. the Bulk,
Index, Delete, Delete-by-Query, Reindex, Update, and Update-by-Query API.
It has been replaced by a somewhat similar wait_for_active_shards
parameter.
See elastic/elasticsearch#19454.