java.asciidoc 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. [[breaking_60_java_changes]]
  2. === Java API changes
  3. ==== `setSource` methods require XContentType
  4. Previously the `setSource` methods and other methods that accepted byte/string representations of
  5. an object source did not require the XContentType to be specified. The auto-detection of the content
  6. type is no longer used, so these methods now require the XContentType as an additional argument when
  7. providing the source in bytes or as a string.
  8. ==== `DeleteByQueryRequest` requires an explicitly set query
  9. In previous versions of Elasticsearch, delete by query requests without an explicit query
  10. were accepted, match_all was used as the default query and all documents were deleted
  11. as a result. From version 6.0.0, a `DeleteByQueryRequest` requires an explicit query be set.
  12. ==== `InternalStats` and `Stats` getCountAsString() method removed
  13. The `count` value in the stats aggregation represents a doc count that shouldn't require a formatted
  14. version. This method was deprecated in 5.4 in favour of just using
  15. `String.valueOf(getCount())` if needed
  16. ==== `ActionRequestBuilder#execute` returns `ActionFuture` rather than `ListenableActionFuture`
  17. When sending a request through the request builders e.g. client.prepareSearch().execute(), it used to
  18. be possible to call `addListener` against the returned `ListenableActionFuture`. With this change an
  19. `ActionFuture` is returned instead, which is consistent with what the `Client` methods return, hence
  20. it is not possible to associate the future with listeners. The `execute` method that accept a listener
  21. as an argument can be used instead.
  22. ==== `Terms.Order` and `Histogram.Order` classes replace by `BucketOrder`
  23. The `terms`, `histogram`, and `date_histogram` aggregation code has been refactored to use common
  24. code for ordering buckets. The `BucketOrder` class must be used instead of `Terms.Order` and
  25. `Histogram.Order`. The `static` methods in the `BucketOrder` class must be called instead of directly
  26. accessing internal order instances, e.g. `BucketOrder.count(boolean)` and `BucketOrder.aggregation(String, boolean)`.
  27. Use `BucketOrder.key(boolean)` to order the `terms` aggregation buckets by `_term`.
  28. === `getTookInMillis()` removed in `BulkResponse`, `SearchResponse` and `TermVectorsResponse`
  29. In `BulkResponse`, `SearchResponse` and `TermVectorsResponse` `getTookInMiilis()` method
  30. has been removed in favor of `getTook` method. `getTookInMiilis()` is easily replaced by
  31. `getTook().getMillis()`.
  32. === `GetField` and `SearchHitField` replaced by `DocumentField`
  33. As `GetField` and `SearchHitField` have the same members, they have been unified into
  34. `DocumentField`.
  35. === Some Aggregation classes have moved packages
  36. The classes for the variants of the range aggregation (geo_distance, date and ip) were moved into the `org.elasticsearch.search.aggregations.bucket.range`
  37. package.
  38. The `org.elasticsearch.search.aggregations.bucket.terms.support` package was removed and the classes were moved to
  39. `org.elasticsearch.search.aggregations.bucket.terms`.
  40. The filter aggregation classes were moved to `org.elasticsearch.search.aggregations.bucket.filter`
  41. === Constructor for `PercentileRanksAggregationBuilder` has changed
  42. It is now required to include the desired ranks as a non-null, non-empty array of doubles to the builder's constructor,
  43. rather than configuring them via a setter on the builder. The setter method `values()` has correspondingly
  44. been removed.