migrate_3_0.asciidoc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. [[breaking-changes-3.0]]
  2. == Breaking changes in 3.0
  3. This section discusses the changes that you need to be aware of when migrating
  4. your application to Elasticsearch 3.0.
  5. * <<breaking_30_search_changes>>
  6. * <<breaking_30_rest_api_changes>>
  7. * <<breaking_30_parent_child_changes>>
  8. * <<breaking_30_settings_changes>>
  9. * <<breaking_30_mapping_changes>>
  10. * <<breaking_30_plugins>>
  11. * <<breaking_30_java_api_changes>>
  12. * <<breaking_30_cache_concurrency>>
  13. * <<breaking_30_non_loopback>>
  14. * <<breaking_30_thread_pool>>
  15. [[breaking_30_search_changes]]
  16. === Search changes
  17. ==== `search_type=count` removed
  18. The `count` search type was deprecated since version 2.0.0 and is now removed.
  19. In order to get the same benefits, you just need to set the value of the `size`
  20. parameter to `0`.
  21. For instance, the following request:
  22. [source,sh]
  23. ---------------
  24. GET /my_index/_search?search_type=count
  25. {
  26. "aggs": {
  27. "my_terms": {
  28. "terms": {
  29. "field": "foo"
  30. }
  31. }
  32. }
  33. }
  34. ---------------
  35. can be replaced with:
  36. [source,sh]
  37. ---------------
  38. GET /my_index/_search
  39. {
  40. "size": 0,
  41. "aggs": {
  42. "my_terms": {
  43. "terms": {
  44. "field": "foo"
  45. }
  46. }
  47. }
  48. }
  49. ---------------
  50. ==== `search_type=scan` removed
  51. The `scan` search type was deprecated since version 2.1.0 and is now removed.
  52. All benefits from this search type can now be achieved by doing a scroll
  53. request that sorts documents in `_doc` order, for instance:
  54. [source,sh]
  55. ---------------
  56. GET /my_index/_search?scroll=2m
  57. {
  58. "sort": [
  59. "_doc"
  60. ]
  61. }
  62. ---------------
  63. Scroll requests sorted by `_doc` have been optimized to more efficiently resume
  64. from where the previous request stopped, so this will have the same performance
  65. characteristics as the former `scan` search type.
  66. [[breaking_30_rest_api_changes]]
  67. === REST API changes
  68. ==== search exists api removed
  69. The search exists api has been removed in favour of using the search api with
  70. `size` set to `0` and `terminate_after` set to `1`.
  71. ==== `/_optimize` endpoint removed
  72. The deprecated `/_optimize` endpoint has been removed. The `/_forcemerge`
  73. endpoint should be used in lieu of optimize.
  74. The `GET` HTTP verb for `/_forcemerge` is no longer supported, please use the
  75. `POST` HTTP verb.
  76. ==== Deprecated queries removed
  77. The following deprecated queries have been removed:
  78. * `filtered`: use `bool` query instead, which supports `filter` clauses too
  79. * `and`: use `must` clauses in a `bool` query instead
  80. * `or`: use should clauses in a `bool` query instead
  81. * `limit`: use `terminate_after` parameter instead
  82. * `fquery`: obsolete after filters and queries have been merged
  83. * `query`: obsolete after filters and queries have been merged
  84. ==== Unified fuzziness parameter
  85. * Removed support for the deprecated `min_similarity` parameter in `fuzzy query`, in favour of `similarity`.
  86. * Removed support for the deprecated `fuzzy_min_sim` parameter in `query_string` query, in favour of `similarity`.
  87. * Removed support for the deprecated `edit_distance` parameter in completion suggester, in favour of `similarity`.
  88. ==== indices query
  89. Removed support for the deprecated `filter` and `no_match_filter` fields in `indices` query,
  90. in favour of `query` and `no_match_query`.
  91. ==== nested query
  92. Removed support for the deprecated `filter` fields in `nested` query, in favour of `query`.
  93. ==== terms query
  94. Removed support for the deprecated `minimum_should_match` and `disable_coord` in `terms` query, use `bool` query instead.
  95. Removed also support for the deprecated `execution` parameter.
  96. ==== function_score query
  97. Removed support for the top level `filter` element in `function_score` query, replaced by `query`.
  98. ==== highlighters
  99. Removed support for multiple highlighter names, the only supported ones are: `plain`, `fvh` and `postings`.
  100. ==== top level filter
  101. Removed support for the deprecated top level `filter` in the search api, replaced by `post_filter`.
  102. ==== `query_binary` and `filter_binary` removed
  103. Removed support for the undocumented `query_binary` and `filter_binary` sections of a search request.
  104. [[breaking_30_parent_child_changes]]
  105. === Parent/Child changes
  106. The `children` aggregation, parent child inner hits and `has_child` and `has_parent` queries will not work on indices
  107. with `_parent` field mapping created before version `2.0.0`. The data of these indices need to be re-indexed into a new index.
  108. The format of the join between parent and child documents have changed with the `2.0.0` release. The old
  109. format can't read from version `3.0.0` and onwards. The new format allows for a much more efficient and
  110. scalable join between parent and child documents and the join data structures are stored on on disk
  111. data structures as opposed as before the join data structures were stored in the jvm heap space.
  112. ==== `score_type` has been removed
  113. The `score_type` option has been removed from the `has_child` and `has_parent` queries in favour of the `score_mode` option
  114. which does the exact same thing.
  115. ==== `sum` score mode removed
  116. The `sum` score mode has been removed in favour of the `total` mode which does the same and is already available in
  117. previous versions.
  118. ==== `max_children` option
  119. When `max_children` was set to `0` on the `has_child` query then there was no upper limit on how many children documents
  120. are allowed to match. This has changed and `0` now really means to zero child documents are allowed. If no upper limit
  121. is needed then the `max_children` option shouldn't be defined at all on the `has_child` query.
  122. [[breaking_30_settings_changes]]
  123. === Settings changes
  124. ==== Analysis settings
  125. The `index.analysis.analyzer.default_index` analyzer is not supported anymore.
  126. If you wish to change the analyzer to use for indexing, change the
  127. `index.analysis.analyzer.default` analyzer instead.
  128. ==== Ping timeout settings
  129. Previously, there were three settings for the ping timeout: `discovery.zen.initial_ping_timeout`,
  130. `discovery.zen.ping.timeout` and `discovery.zen.ping_timeout`. The former two have been removed and
  131. the only setting key for the ping timeout is now `discovery.zen.ping_timeout`. The default value for
  132. ping timeouts remains at three seconds.
  133. ==== Recovery settings
  134. Recovery settings deprecated in 1.x have been removed:
  135. * `index.shard.recovery.translog_size` is superseded by `indices.recovery.translog_size`
  136. * `index.shard.recovery.translog_ops` is superseded by `indices.recovery.translog_ops`
  137. * `index.shard.recovery.file_chunk_size` is superseded by `indices.recovery.file_chunk_size`
  138. * `index.shard.recovery.concurrent_streams` is superseded by `indices.recovery.concurrent_streams`
  139. * `index.shard.recovery.concurrent_small_file_streams` is superseded by `indices.recovery.concurrent_small_file_streams`
  140. * `indices.recovery.max_size_per_sec` is superseded by `indices.recovery.max_bytes_per_sec`
  141. If you are using any of these settings please take the time and review their purpose. All of the settings above are considered
  142. _expert settings_ and should only be used if absolutely necessary. If you have set any of the above setting as persistent
  143. cluster settings please use the settings update API and set their superseded keys accordingly.
  144. [[breaking_30_mapping_changes]]
  145. === Mapping changes
  146. ==== Transform removed
  147. The `transform` feature from mappings has been removed. It made issues very hard to debug.
  148. [[breaking_30_plugins]]
  149. === Plugin changes
  150. Plugins implementing custom queries need to implement the `fromXContent(QueryParseContext)` method in their
  151. `QueryParser` subclass rather than `parse`. This method will take care of parsing the query from `XContent` format
  152. into an intermediate query representation that can be streamed between the nodes in binary format, effectively the
  153. query object used in the java api. Also, the query parser needs to implement the `getBuilderPrototype` method that
  154. returns a prototype of the `NamedWriteable` query, which allows to deserialize an incoming query by calling
  155. `readFrom(StreamInput)` against it, which will create a new object, see usages of `Writeable`. The `QueryParser`
  156. also needs to declare the generic type of the query that it supports and it's able to parse.
  157. The query object can then transform itself into a lucene query through the new `toQuery(QueryShardContext)` method,
  158. which returns a lucene query to be executed on the data node.
  159. Similarly, plugins implementing custom score functions need to implement the `fromXContent(QueryParseContext)`
  160. method in their `ScoreFunctionParser` subclass rather than `parse`. This method will take care of parsing
  161. the function from `XContent` format into an intermediate function representation that can be streamed between
  162. the nodes in binary format, effectively the function object used in the java api. Also, the query parser needs
  163. to implement the `getBuilderPrototype` method that returns a prototype of the `NamedWriteable` function, which
  164. allows to deserialize an incoming function by calling `readFrom(StreamInput)` against it, which will create a
  165. new object, see usages of `Writeable`. The `ScoreFunctionParser` also needs to declare the generic type of the
  166. function that it supports and it's able to parse. The function object can then transform itself into a lucene
  167. function through the new `toFunction(QueryShardContext)` method, which returns a lucene function to be executed
  168. on the data node.
  169. ==== Cloud AWS plugin changes
  170. Cloud AWS plugin has been split in two plugins:
  171. * {plugins}/discovery-ec2.html[Discovery EC2 plugin]
  172. * {plugins}/repository-s3.html[Repository S3 plugin]
  173. ==== Cloud Azure plugin changes
  174. Cloud Azure plugin has been split in three plugins:
  175. * {plugins}/discovery-azure.html[Discovery Azure plugin]
  176. * {plugins}/repository-azure.html[Repository Azure plugin]
  177. * {plugins}/store-smb.html[Store SMB plugin]
  178. If you were using the `cloud-azure` plugin for snapshot and restore, you had in `elasticsearch.yml`:
  179. [source,yaml]
  180. -----
  181. cloud:
  182. azure:
  183. storage:
  184. account: your_azure_storage_account
  185. key: your_azure_storage_key
  186. -----
  187. You need to give a unique id to the storage details now as you can define multiple storage accounts:
  188. [source,yaml]
  189. -----
  190. cloud:
  191. azure:
  192. storage:
  193. my_account:
  194. account: your_azure_storage_account
  195. key: your_azure_storage_key
  196. -----
  197. ==== Cloud GCE plugin changes
  198. Cloud GCE plugin has been renamed to {plugins}/discovery-gce.html[Discovery GCE plugin].
  199. [[breaking_30_java_api_changes]]
  200. === Java API changes
  201. ==== Count api has been removed
  202. The deprecated count api has been removed from the Java api, use the search api instead and set size to 0.
  203. The following call
  204. [source,java]
  205. -----
  206. client.prepareCount(indices).setQuery(query).get();
  207. -----
  208. can be replaced with
  209. [source,java]
  210. -----
  211. client.prepareSearch(indices).setSource(new SearchSourceBuilder().size(0).query(query)).get();
  212. -----
  213. ==== BoostingQueryBuilder
  214. Removed setters for mandatory positive/negative query. Both arguments now have
  215. to be supplied at construction time already and have to be non-null.
  216. ==== SpanContainingQueryBuilder
  217. Removed setters for mandatory big/little inner span queries. Both arguments now have
  218. to be supplied at construction time already and have to be non-null. Updated
  219. static factory methods in QueryBuilders accordingly.
  220. ==== SpanOrQueryBuilder
  221. Making sure that query contains at least one clause by making initial clause mandatory
  222. in constructor.
  223. ==== SpanNearQueryBuilder
  224. Removed setter for mandatory slop parameter, needs to be set in constructor now. Also
  225. making sure that query contains at least one clause by making initial clause mandatory
  226. in constructor. Updated the static factory methods in QueryBuilders accordingly.
  227. ==== SpanNotQueryBuilder
  228. Removed setter for mandatory include/exclude span query clause, needs to be set in constructor now.
  229. Updated the static factory methods in QueryBuilders and tests accordingly.
  230. ==== SpanWithinQueryBuilder
  231. Removed setters for mandatory big/little inner span queries. Both arguments now have
  232. to be supplied at construction time already and have to be non-null. Updated
  233. static factory methods in QueryBuilders accordingly.
  234. ==== QueryFilterBuilder
  235. Removed the setter `queryName(String queryName)` since this field is not supported
  236. in this type of query. Use `FQueryFilterBuilder.queryName(String queryName)` instead
  237. when in need to wrap a named query as a filter.
  238. ==== WrapperQueryBuilder
  239. Removed `wrapperQueryBuilder(byte[] source, int offset, int length)`. Instead simply
  240. use `wrapperQueryBuilder(byte[] source)`. Updated the static factory methods in
  241. QueryBuilders accordingly.
  242. ==== QueryStringQueryBuilder
  243. Removed ability to pass in boost value using `field(String field)` method in form e.g. `field^2`.
  244. Use the `field(String, float)` method instead.
  245. ==== Operator
  246. Removed the enums called `Operator` from `MatchQueryBuilder`, `QueryStringQueryBuilder`,
  247. `SimpleQueryStringBuilder`, and `CommonTermsQueryBuilder` in favour of using the enum
  248. defined in `org.elasticsearch.index.query.Operator` in an effort to consolidate the
  249. codebase and avoid duplication.
  250. ==== queryName and boost support
  251. Support for `queryName` and `boost` has been streamlined to all of the queries. That is
  252. a breaking change till queries get sent over the network as serialized json rather
  253. than in `Streamable` format. In fact whenever additional fields are added to the json
  254. representation of the query, older nodes might throw error when they find unknown fields.
  255. ==== InnerHitsBuilder
  256. InnerHitsBuilder now has a dedicated addParentChildInnerHits and addNestedInnerHits methods
  257. to differentiate between inner hits for nested vs. parent / child documents. This change
  258. makes the type / path parameter mandatory.
  259. ==== MatchQueryBuilder
  260. Moving MatchQueryBuilder.Type and MatchQueryBuilder.ZeroTermsQuery enum to MatchQuery.Type.
  261. Also reusing new Operator enum.
  262. ==== MoreLikeThisQueryBuilder
  263. Removed `MoreLikeThisQueryBuilder.Item#id(String id)`, `Item#doc(BytesReference doc)`,
  264. `Item#doc(XContentBuilder doc)`. Use provided constructors instead.
  265. Removed `MoreLikeThisQueryBuilder#addLike` in favor of texts and/or items being provided
  266. at construction time. Using arrays there instead of lists now.
  267. Removed `MoreLikeThisQueryBuilder#addUnlike` in favor to using the `unlike` methods
  268. which take arrays as arguments now rather than the lists used before.
  269. The deprecated `docs(Item... docs)`, `ignoreLike(Item... docs)`,
  270. `ignoreLike(String... likeText)`, `addItem(Item... likeItems)` have been removed.
  271. ==== GeoDistanceQueryBuilder
  272. Removing individual setters for lon() and lat() values, both values should be set together
  273. using point(lon, lat).
  274. ==== GeoDistanceRangeQueryBuilder
  275. Removing setters for to(Object ...) and from(Object ...) in favour of the only two allowed input
  276. arguments (String, Number). Removing setter for center point (point(), geohash()) because parameter
  277. is mandatory and should already be set in constructor.
  278. Also removing setters for lt(), lte(), gt(), gte() since they can all be replaced by equivallent
  279. calls to to/from() and inludeLower()/includeUpper().
  280. ==== GeoPolygonQueryBuilder
  281. Require shell of polygon already to be specified in constructor instead of adding it pointwise.
  282. This enables validation, but makes it necessary to remove the addPoint() methods.
  283. ==== MultiMatchQueryBuilder
  284. Moving MultiMatchQueryBuilder.ZeroTermsQuery enum to MatchQuery.ZeroTermsQuery.
  285. Also reusing new Operator enum.
  286. Removed ability to pass in boost value using `field(String field)` method in form e.g. `field^2`.
  287. Use the `field(String, float)` method instead.
  288. ==== MissingQueryBuilder
  289. The MissingQueryBuilder which was deprecated in 2.2.0 is removed. As a replacement use ExistsQueryBuilder
  290. inside a mustNot() clause. So instead of using `new ExistsQueryBuilder(name)` now use
  291. `new BoolQueryBuilder().mustNot(new ExistsQueryBuilder(name))`.
  292. ==== NotQueryBuilder
  293. The NotQueryBuilder which was deprecated in 2.1.0 is removed. As a replacement use BoolQueryBuilder
  294. with added mustNot() clause. So instead of using `new NotQueryBuilder(filter)` now use
  295. `new BoolQueryBuilder().mustNot(filter)`.
  296. ==== TermsQueryBuilder
  297. Remove the setter for `termsLookup()`, making it only possible to either use a TermsLookup object or
  298. individual values at construction time. Also moving individual settings for the TermsLookup (lookupIndex,
  299. lookupType, lookupId, lookupPath) to the separate TermsLookup class, using constructor only and moving
  300. checks for validation there. Removed `TermsLookupQueryBuilder` in favour of `TermsQueryBuilder`.
  301. ==== FunctionScoreQueryBuilder
  302. `add` methods have been removed, all filters and functions must be provided as constructor arguments by
  303. creating an array of `FunctionScoreQueryBuilder.FilterFunctionBuilder` objects, containing one element
  304. for each filter/function pair.
  305. `scoreMode` and `boostMode` can only be provided using corresponding enum members instead
  306. of string values: see `FilterFunctionScoreQuery.ScoreMode` and `CombineFunction`.
  307. `CombineFunction.MULT` has been renamed to `MULTIPLY`.
  308. ==== IdsQueryBuilder
  309. For simplicity, only one way of adding the ids to the existing list (empty by default) is left: `addIds(String...)`
  310. ==== DocumentAlreadyExistsException removed
  311. `DocumentAlreadyExistsException` is removed and a `VersionConflictException` is thrown instead (with a better
  312. error description). This will influence code that use the `IndexRequest.opType()` or `IndexRequest.create()`
  313. to index a document only if it doesn't already exist.
  314. ==== ShapeBuilders
  315. `InternalLineStringBuilder` is removed in favour of `LineStringBuilder`, `InternalPolygonBuilder` in favour of PolygonBuilder` and `Ring` has been replaced with `LineStringBuilder`. Also the abstract base classes `BaseLineStringBuilder` and `BasePolygonBuilder` haven been merged with their corresponding implementations.
  316. [[breaking_30_cache_concurrency]]
  317. === Cache concurrency level settings removed
  318. Two cache concurrency level settings `indices.requests.cache.concurrency_level` and
  319. `indices.fielddata.cache.concurrency_level` because they no longer apply to the cache implementation used for the
  320. request cache and the field data cache.
  321. [[breaking_30_non_loopback]]
  322. === Remove bind option of `non_loopback`
  323. This setting would arbitrarily pick the first interface not marked as loopback. Instead, specify by address
  324. scope (e.g. `_local_,_site_` for all loopback and private network addresses) or by explicit interface names,
  325. hostnames, or addresses.
  326. [[breaking_30_thread_pool]]
  327. === Forbid changing of thread pool types
  328. Previously, <<modules-threadpool,thread pool types>> could be dynamically adjusted. The thread pool type effectively
  329. controls the backing queue for the thread pool and modifying this is an expert setting with minimal practical benefits
  330. and high risk of being misused. The ability to change the thread pool type for any thread pool has been removed; do note
  331. that it is still possible to adjust relevant thread pool parameters for each of the thread pools (e.g., depending on
  332. the thread pool type, `keep_alive`, `queue_size`, etc.).
  333. === Adding system CPU percent to OS stats
  334. The recent CPU usage (as a percent) has been added to the OS stats reported under the node stats API and the cat nodes
  335. API. The breaking change here is that there is a new object in the "os" object in the node stats response. This object
  336. is called "cpu" and includes "percent" and "load_average" as fields. This moves the "load_average" field that was
  337. previously a top-level field in the "os" object to the "cpu" object. Additionally, the "cpu" field in the cat nodes API
  338. response is output by default.
  339. Finally, the API for org.elasticsearch.monitor.os.OsStats has changed. The `getLoadAverage` method has been removed. The
  340. value for this can now be obtained from `OsStats.Cpu#getLoadAverage`. Additionally, the recent CPU usage can be obtained
  341. from `OsStats.Cpu#getPercent`.
  342. === Fields option
  343. Only stored fields are retrievable with this option.
  344. The fields option won't be able to load non stored fields from _source anymore.