migrate_2_0.asciidoc 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018
  1. [[breaking-changes-2.0]]
  2. == Breaking changes in 2.0
  3. This section discusses the changes that you need to be aware of when migrating
  4. your application to Elasticsearch 2.0.
  5. [float]
  6. === Indices created before 0.90
  7. Elasticsearch 2.0 can read indices created in version 0.90 and above. If any
  8. of your indices were created before 0.90 you will need to upgrade to the
  9. latest 1.x version of Elasticsearch first, in order to upgrade your indices or
  10. to delete the old indices. Elasticsearch will not start in the presence of old
  11. indices.
  12. [float]
  13. === Elasticsearch migration plugin
  14. We have provided the https://github.com/elastic/elasticsearch-migration[Elasticsearch migration plugin]
  15. to help you detect any issues that you may have when upgrading to
  16. Elasticsearch 2.0. Please install and run the plugin *before* upgrading.
  17. === Mapping
  18. Remove file based default mappings #10870 (issue: #10620)
  19. Validate dynamic mappings updates on the master node. #10634 (issues: #8650, #8688)
  20. Remove the ability to have custom per-field postings and doc values formats. #9741 (issue: #8746)
  21. Remove support for new indexes using path setting in object/nested fields or index_name in any field #9570 (issue: #6677)
  22. Remove index_analyzer setting to simplify analyzer logic #9451 (issue: #9371)
  23. Remove type level default analyzers #9430 (issues: #8874, #9365)
  24. Add doc values support to boolean fields. #7961 (issues: #4678, #7851)
  25. A number of changes have been made to mappings to remove ambiguity and to
  26. ensure that conflicting mappings cannot be created.
  27. ==== Conflicting field mappings
  28. Fields with the same name, in the same index, in different types, must have
  29. the same mapping, with the exception of the <<copy-to>>, <<dynamic>>,
  30. <<enabled>>, <<ignore-above>>, <<include-in-all>>, and <<properties>>
  31. parameters, which may have different settings per field.
  32. [source,js]
  33. ---------------
  34. PUT my_index
  35. {
  36. "mappings": {
  37. "type_one": {
  38. "properties": {
  39. "name": { <1>
  40. "type": "string"
  41. }
  42. }
  43. },
  44. "type_two": {
  45. "properties": {
  46. "name": { <1>
  47. "type": "string",
  48. "analyzer": "english"
  49. }
  50. }
  51. }
  52. }
  53. }
  54. ---------------
  55. <1> The two `name` fields have conflicting mappings and will prevent Elasticsearch
  56. from starting.
  57. Elasticsearch will not start in the presence of conflicting field mappings.
  58. These indices must be deleted or reindexed using a new mapping.
  59. The `ignore_conflicts` option of the put mappings API has been removed.
  60. Conflicts can't be ignored anymore.
  61. ==== Fields cannot be referenced by short name
  62. A field can no longer be referenced using its short name. Instead, the full
  63. path to the field is required. For instance:
  64. [source,js]
  65. ---------------
  66. PUT my_index
  67. {
  68. "mappings": {
  69. "my_type": {
  70. "properties": {
  71. "title": { "type": "string" }, <1>
  72. "name": {
  73. "properties": {
  74. "title": { "type": "string" }, <2>
  75. "first": { "type": "string" },
  76. "last": { "type": "string" }
  77. }
  78. }
  79. }
  80. }
  81. }
  82. }
  83. ---------------
  84. <1> This field is referred to as `title`.
  85. <2> This field is referred to as `name.title`.
  86. Previously, the two `title` fields in the example above could have been
  87. confused with each other when using the short name `title`.
  88. === Type name prefix removed
  89. Previously, two fields with the same name in two different types could
  90. sometimes be disambiguated by prepending the type name. As a side effect, it
  91. would add a filter on the type name to the relevant query. This feature was
  92. ambiguous -- a type name could be confused with a field name -- and didn't
  93. work everywhere e.g. aggregations.
  94. Instead, fields should be specified with the full path, but without a type
  95. name prefix. If you wish to filter by the `_type` field, either specify the
  96. type in the URL or add an explicit filter.
  97. The following example query in 1.x:
  98. [source,js]
  99. ----------------------------
  100. GET my_index/_search
  101. {
  102. "query": {
  103. "match": {
  104. "my_type.some_field": "quick brown fox"
  105. }
  106. }
  107. }
  108. ----------------------------
  109. would be rewritten in 2.0 as:
  110. [source,js]
  111. ----------------------------
  112. GET my_index/my_type/_search <1>
  113. {
  114. "query": {
  115. "match": {
  116. "some_field": "quick brown fox" <2>
  117. }
  118. }
  119. }
  120. ----------------------------
  121. <1> The type name can be specified in the URL to act as a filter.
  122. <2> The field name should be specified without the type prefix.
  123. ==== Field names may not contain dots
  124. In 1.x, it was possible to create fields with dots in their name, for
  125. instance:
  126. [source,js]
  127. ----------------------------
  128. PUT my_index
  129. {
  130. "mappings": {
  131. "my_type": {
  132. "properties": {
  133. "foo.bar": { <1>
  134. "type": "string"
  135. },
  136. "foo": {
  137. "properties": {
  138. "bar": { <1>
  139. "type": "string"
  140. }
  141. }
  142. }
  143. }
  144. }
  145. }
  146. }
  147. ----------------------------
  148. <1> These two fields cannot be distinguised as both are referred to as `foo.bar`.
  149. You can no longer create fields with dots in the name.
  150. ==== Type names may not start with a dot
  151. In 1.x, Elasticsearch would issue a warning if a type name included a dot,
  152. e.g. `my.type`. Now that type names are no longer used to distinguish between
  153. fields in differnt types, this warning has been relaxed: type names may now
  154. contain dots, but they may not *begin* with a dot. The only exception to this
  155. is the special `.percolator` type.
  156. ==== Types may no longer be deleted
  157. In 1.x it was possible to delete a type mapping, along with all of the
  158. documents of that type, using the delete mapping API. This is no longer
  159. supported, because remnants of the fields in the type could remain in the
  160. index, causing corruption later on.
  161. ==== Type meta-fields
  162. The <<mapping-fields,meta-fields>> associated with had configuration options
  163. removed, to make them more reliable:
  164. * `_id` configuration can no longer be changed. If you need to sort, use the <<mapping-uid-field,`_uid`>> field instead.
  165. * `_type` configuration can no longer be changed.
  166. * `_index` configuration can no longer be changed.
  167. * `_routing` configuration is limited to marking routing as required.
  168. * `_field_names` configuration is limited to disabling the field.
  169. * `_size` configuration is limited to enabling the field.
  170. * `_timestamp` configuration is limited to enabling the field, setting format and default value.
  171. * `_boost` has been removed.
  172. * `_analyzer` has been removed.
  173. Importantly, *meta-fields can no longer be specified as part of the document
  174. body.* Instead, they must be specified in the query string parameters. For
  175. instance, in 1.x, the `routing` could be specified as follows:
  176. [source,json]
  177. -----------------------------
  178. PUT my_index
  179. {
  180. "mappings": {
  181. "my_type": {
  182. "_routing": {
  183. "path": "group" <1>
  184. },
  185. "properties": {
  186. "group": { <1>
  187. "type": "string"
  188. }
  189. }
  190. }
  191. }
  192. }
  193. PUT my_index/my_type/1 <2>
  194. {
  195. "group": "foo"
  196. }
  197. -----------------------------
  198. <1> This 1.x mapping tells Elasticsearch to extract the `routing` value from the `group` field in the document body.
  199. <2> This indexing request uses a `routing` value of `foo`.
  200. In 2.0, the routing must be specified explicitly:
  201. [source,json]
  202. -----------------------------
  203. PUT my_index
  204. {
  205. "mappings": {
  206. "my_type": {
  207. "_routing": {
  208. "required": true <1>
  209. },
  210. "properties": {
  211. "group": {
  212. "type": "string"
  213. }
  214. }
  215. }
  216. }
  217. }
  218. PUT my_index/my_type/1?routing=bar <2>
  219. {
  220. "group": "foo"
  221. }
  222. -----------------------------
  223. <1> Routing can be marked as required to ensure it is not forgotten during indexing.
  224. <2> This indexing request uses a `routing` value of `bar`.
  225. ==== Other mapping changes
  226. * The setting `index.mapping.allow_type_wrapper` has been removed. Documents should always be sent without the type as the root element.
  227. * The `binary` field does not support the `compress` and `compress_threshold` options anymore.
  228. === Networking
  229. Elasticsearch now binds to the loopback interface by default (usually 127.0.0.1
  230. or ::1), the setting `network.host` can be specified to change this behavior.
  231. === Rivers removal
  232. Elasticsearch does not support rivers anymore. While we had first planned to
  233. keep them around to ease migration, keeping support for rivers proved to be
  234. challenging as it conflicted with other important changes that we wanted to
  235. bring to 2.0 like synchronous dynamic mappings updates, so we eventually
  236. decided to remove them entirely. See
  237. https://www.elastic.co/blog/deprecating_rivers for more background about why
  238. we are moving away from rivers.
  239. === Indices API
  240. The <<alias-retrieving, get alias api>> will, by default produce an error response
  241. if a requested index does not exist. This change brings the defaults for this API in
  242. line with the other Indices APIs. The <<multi-index>> options can be used on a request
  243. to change this behavior
  244. `GetIndexRequest.features()` now returns an array of Feature Enums instead of an array of String values.
  245. The following deprecated methods have been removed:
  246. * `GetIndexRequest.addFeatures(String[])` - Please use `GetIndexRequest.addFeatures(Feature[])` instead
  247. * `GetIndexRequest.features(String[])` - Please use `GetIndexRequest.features(Feature[])` instead
  248. * `GetIndexRequestBuilder.addFeatures(String[])` - Please use `GetIndexRequestBuilder.addFeatures(Feature[])` instead
  249. * `GetIndexRequestBuilder.setFeatures(String[])` - Please use `GetIndexRequestBuilder.setFeatures(Feature[])` instead
  250. === Partial fields
  251. Partial fields were deprecated since 1.0.0beta1 in favor of <<search-request-source-filtering,source filtering>>.
  252. === More Like This
  253. The More Like This API and the More Like This Field query have been removed in
  254. favor of the <<query-dsl-mlt-query, More Like This Query>>.
  255. The parameter `percent_terms_to_match` has been removed in favor of
  256. `minimum_should_match`.
  257. === Routing
  258. The default hash function that is used for routing has been changed from djb2 to
  259. murmur3. This change should be transparent unless you relied on very specific
  260. properties of djb2. This will help ensure a better balance of the document counts
  261. between shards.
  262. In addition, the following node settings related to routing have been deprecated:
  263. [horizontal]
  264. `cluster.routing.operation.hash.type`::
  265. This was an undocumented setting that allowed to configure which hash function
  266. to use for routing. `murmur3` is now enforced on new indices.
  267. `cluster.routing.operation.use_type`::
  268. This was an undocumented setting that allowed to take the `_type` of the
  269. document into account when computing its shard (default: `false`). `false` is
  270. now enforced on new indices.
  271. === Async replication
  272. The `replication` parameter has been removed from all CRUD operations (index,
  273. update, delete, bulk). These operations are now synchronous
  274. only, and a request will only return once the changes have been replicated to
  275. all active shards in the shard group.
  276. === Store
  277. The `memory` / `ram` store (`index.store.type`) option was removed in Elasticsearch 2.0.
  278. === Term Vectors API
  279. Usage of `/_termvector` is deprecated, and replaced in favor of `/_termvectors`.
  280. === Script fields
  281. Script fields in 1.x were only returned as a single value. So even if the return
  282. value of a script used to be list, it would be returned as an array containing
  283. a single value that is a list too, such as:
  284. [source,js]
  285. ---------------
  286. "fields": {
  287. "my_field": [
  288. [
  289. "v1",
  290. "v2"
  291. ]
  292. ]
  293. }
  294. ---------------
  295. In elasticsearch 2.x, scripts that return a list of values are considered as
  296. multivalued fields. So the same example would return the following response,
  297. with values in a single array.
  298. [source,js]
  299. ---------------
  300. "fields": {
  301. "my_field": [
  302. "v1",
  303. "v2"
  304. ]
  305. }
  306. ---------------
  307. === Main API
  308. Previously, calling `GET /` was giving back the http status code within the json response
  309. in addition to the actual HTTP status code. We removed `status` field in json response.
  310. === Java API
  311. `org.elasticsearch.index.queries.FilterBuilders` has been removed as part of the merge of
  312. queries and filters. These filters are now available in `QueryBuilders` with the same name.
  313. All methods that used to accept a `FilterBuilder` now accept a `QueryBuilder` instead.
  314. In addition some query builders have been removed or renamed:
  315. * `commonTerms(...)` renamed with `commonTermsQuery(...)`
  316. * `queryString(...)` renamed with `queryStringQuery(...)`
  317. * `simpleQueryString(...)` renamed with `simpleQueryStringQuery(...)`
  318. * `textPhrase(...)` removed
  319. * `textPhrasePrefix(...)` removed
  320. * `textPhrasePrefixQuery(...)` removed
  321. * `filtered(...)` removed. Use `filteredQuery(...)` instead.
  322. * `inQuery(...)` removed.
  323. === Aggregations
  324. The `date_histogram` aggregation now returns a `Histogram` object in the response, and the `DateHistogram` class has been removed. Similarly
  325. the `date_range`, `ipv4_range`, and `geo_distance` aggregations all return a `Range` object in the response, and the `IPV4Range`, `DateRange`,
  326. and `GeoDistance` classes have been removed. The motivation for this is to have a single response API for the Range and Histogram aggregations
  327. regardless of the type of data being queried. To support this some changes were made in the `MultiBucketAggregation` interface which applies
  328. to all bucket aggregations:
  329. * The `getKey()` method now returns `Object` instead of `String`. The actual object type returned depends on the type of aggregation requested
  330. (e.g. the `date_histogram` will return a `DateTime` object for this method whereas a `histogram` will return a `Number`).
  331. * A `getKeyAsString()` method has been added to return the String representation of the key.
  332. * All other `getKeyAsX()` methods have been removed.
  333. * The `getBucketAsKey(String)` methods have been removed on all aggregations except the `filters` and `terms` aggregations.
  334. The `histogram` and the `date_histogram` aggregation now support a simplified `offset` option that replaces the previous `pre_offset` and
  335. `post_offset` rounding options. Instead of having to specify two separate offset shifts of the underlying buckets, the `offset` option
  336. moves the bucket boundaries in positive or negative direction depending on its argument.
  337. The `date_histogram` options for `pre_zone` and `post_zone` are replaced by the `time_zone` option. The behavior of `time_zone` is
  338. equivalent to the former `pre_zone` option. Setting `time_zone` to a value like "+01:00" now will lead to the bucket calculations
  339. being applied in the specified time zone but In addition to this, also the `pre_zone_adjust_large_interval` is removed because we
  340. now always return dates and bucket keys in UTC.
  341. Both the `histogram` and `date_histogram` aggregations now have a default `min_doc_count` of `0` instead of `1` previously.
  342. `include`/`exclude` filtering on the `terms` aggregation now uses the same syntax as regexp queries instead of the Java syntax. While simple
  343. regexps should still work, more complex ones might need some rewriting. Also, the `flags` parameter is not supported anymore.
  344. === Terms filter lookup caching
  345. The terms filter lookup mechanism does not support the `cache` option anymore
  346. and relies on the filesystem cache instead. If the lookup index is not too
  347. large, it is recommended to make it replicated to all nodes by setting
  348. `index.auto_expand_replicas: 0-all` in order to remove the network overhead as
  349. well.
  350. === Delete by query
  351. The meaning of the `_shards` headers in the delete by query response has changed. Before version 2.0 the `total`,
  352. `successful` and `failed` fields in the header are based on the number of primary shards. The failures on replica
  353. shards aren't being kept track of. From version 2.0 the stats in the `_shards` header are based on all shards
  354. of an index. The http status code is left unchanged and is only based on failures that occurred while executing on
  355. primary shards.
  356. === Delete api with missing routing when required
  357. Delete api requires a routing value when deleting a document belonging to a type that has routing set to required in its
  358. mapping, whereas previous elasticsearch versions would trigger a broadcast delete on all shards belonging to the index.
  359. A `RoutingMissingException` is now thrown instead.
  360. ==== Default date format now is `strictDateOptionalTime`
  361. Instead of `dateOptionalTime` the new default date format now is `strictDateOptionalTime`,
  362. which is more strict in parsing dates. This means, that dates now need to have a four digit year,
  363. a two-digit month, day, hour, minute and second. This means, you may need to preprend a part of the date
  364. with a zero to make it conform or switch back to the old `dateOptionalTime` format.
  365. ==== Date format does not support unix timestamps by default
  366. In earlier versions of elasticsearch, every timestamp was always tried to be parsed as
  367. as unix timestamp first. This means, even when specifying a date format like
  368. `dateOptionalTime`, one could supply unix timestamps instead of a ISO8601 formatted
  369. date.
  370. This is not supported anymore. If you want to store unix timestamps, you need to specify
  371. the appropriate formats in the mapping, namely `epoch_second` or `epoch_millis`.
  372. In addition the `numeric_resolution` mapping parameter is ignored. Use the
  373. `epoch_second` and `epoch_millis` date formats instead.
  374. ==== Source field limitations
  375. The `_source` field could previously be disabled dynamically. Since this field
  376. is a critical piece of many features like the Update API, it is no longer
  377. possible to disable.
  378. The options for `compress` and `compress_threshold` have also been removed.
  379. The source field is already compressed. To minimize the storage cost,
  380. set `index.codec: best_compression` in index settings.
  381. ==== Boolean fields
  382. Boolean fields used to have a string fielddata with `F` meaning `false` and `T`
  383. meaning `true`. They have been refactored to use numeric fielddata, with `0`
  384. for `false` and `1` for `true`. As a consequence, the format of the responses of
  385. the following APIs changed when applied to boolean fields: `0`/`1` is returned
  386. instead of `F`/`T`:
  387. - <<search-request-fielddata-fields,fielddata fields>>
  388. - <<search-request-sort,sort values>>
  389. - <<search-aggregations-bucket-terms-aggregation,terms aggregations>>
  390. In addition, terms aggregations use a custom formatter for boolean (like for
  391. dates and ip addresses, which are also backed by numbers) in order to return
  392. the user-friendly representation of boolean fields: `false`/`true`:
  393. [source,js]
  394. ---------------
  395. "buckets": [
  396. {
  397. "key": 0,
  398. "key_as_string": "false",
  399. "doc_count": 42
  400. },
  401. {
  402. "key": 1,
  403. "key_as_string": "true",
  404. "doc_count": 12
  405. }
  406. ]
  407. ---------------
  408. ==== Murmur3 Fields
  409. Fields of type `murmur3` can no longer change `doc_values` or `index` setting.
  410. They are always stored with doc values, and not indexed.
  411. ==== Config based mappings
  412. The ability to specify mappings in configuration files has been removed. To specify
  413. default mappings that apply to multiple indexes, use index templates.
  414. The following settings are no longer valid:
  415. * `index.mapper.default_mapping_location`
  416. * `index.mapper.default_percolator_mapping_location`
  417. === Codecs
  418. It is no longer possible to specify per-field postings and doc values formats
  419. in the mappings. This setting will be ignored on indices created before
  420. elasticsearch 2.0 and will cause mapping parsing to fail on indices created on
  421. or after 2.0. For old indices, this means that new segments will be written
  422. with the default postings and doc values formats of the current codec.
  423. It is still possible to change the whole codec by using the `index.codec`
  424. setting. Please however note that using a non-default codec is discouraged as
  425. it could prevent future versions of Elasticsearch from being able to read the
  426. index.
  427. === Scripting settings
  428. Removed support for `script.disable_dynamic` node setting, replaced by
  429. fine-grained script settings described in the <<enable-dynamic-scripting,scripting docs>>.
  430. The following setting previously used to enable dynamic scripts:
  431. [source,yaml]
  432. ---------------
  433. script.disable_dynamic: false
  434. ---------------
  435. can be replaced with the following two settings in `elasticsearch.yml` that
  436. achieve the same result:
  437. [source,yaml]
  438. ---------------
  439. script.inline: on
  440. script.indexed: on
  441. ---------------
  442. === Script parameters
  443. Deprecated script parameters `id`, `file`, `scriptField`, `script_id`, `script_file`,
  444. `script`, `lang` and `params`. The <<modules-scripting,new script API syntax>> should be used in their place.
  445. The deprecated script parameters have been removed from the Java API so applications using the Java API will
  446. need to be updated.
  447. === Groovy scripts sandbox
  448. The groovy sandbox and related settings have been removed. Groovy is now a non
  449. sandboxed scripting language, without any option to turn the sandbox on.
  450. === Plugins making use of scripts
  451. Plugins that make use of scripts must register their own script context through
  452. `ScriptModule`. Script contexts can be used as part of fine-grained settings to
  453. enable/disable scripts selectively.
  454. === Thrift and memcached transport
  455. The thrift and memcached transport plugins are no longer supported. Instead, use
  456. either the HTTP transport (enabled by default) or the node or transport Java client.
  457. === `search_type=count` deprecation
  458. The `count` search type has been deprecated. All benefits from this search type can
  459. now be achieved by using the `query_then_fetch` search type (which is the
  460. default) and setting `size` to `0`.
  461. === The count api internally uses the search api
  462. The count api is now a shortcut to the search api with `size` set to 0. As a
  463. result, a total failure will result in an exception being returned rather
  464. than a normal response with `count` set to `0` and shard failures.
  465. === JSONP support
  466. JSONP callback support has now been removed. CORS should be used to access Elasticsearch
  467. over AJAX instead:
  468. [source,yaml]
  469. ---------------
  470. http.cors.enabled: true
  471. http.cors.allow-origin: /https?:\/\/localhost(:[0-9]+)?/
  472. ---------------
  473. === CORS allowed origins
  474. The CORS allowed origins setting, `http.cors.allow-origin`, no longer has a default value. Previously, the default value
  475. was `*`, which would allow CORS requests from any origin and is considered insecure. The `http.cors.allow-origin` setting
  476. should be specified with only the origins that should be allowed, like so:
  477. [source,yaml]
  478. ---------------
  479. http.cors.allow-origin: /https?:\/\/localhost(:[0-9]+)?/
  480. ---------------
  481. === Cluster state REST api
  482. The cluster state api doesn't return the `routing_nodes` section anymore when
  483. `routing_table` is requested. The newly introduced `routing_nodes` flag can
  484. be used separately to control whether `routing_nodes` should be returned.
  485. === Query DSL
  486. Change to ranking behaviour: single-term queries on numeric fields now score in the same way as string fields (use of IDF, norms if enabled).
  487. Previously, term queries on numeric fields were deliberately prevented from using the usual Lucene scoring logic and this behaviour was undocumented and, to some, unexpected.
  488. If the introduction of scoring to numeric fields is undesirable for your query clauses the fix is simple: wrap them in a `constant_score` or use a `filter` expression instead.
  489. The `filtered` query is deprecated. Instead you should use a `bool` query with
  490. a `must` clause for the query and a `filter` clause for the filter. For instance
  491. the below query:
  492. [source,js]
  493. ---------------
  494. {
  495. "filtered": {
  496. "query": {
  497. // query
  498. },
  499. "filter": {
  500. // filter
  501. }
  502. }
  503. }
  504. ---------------
  505. can be replaced with
  506. [source,js]
  507. ---------------
  508. {
  509. "bool": {
  510. "must": {
  511. // query
  512. },
  513. "filter": {
  514. // filter
  515. }
  516. }
  517. }
  518. ---------------
  519. and will produce the same scores.
  520. The `fuzzy_like_this` and `fuzzy_like_this_field` queries have been removed.
  521. The `limit` filter is deprecated and becomes a no-op. You can achieve similar
  522. behaviour using the <<search-request-body,terminate_after>> parameter.
  523. `or` and `and` on the one hand and `bool` on the other hand used to have
  524. different performance characteristics depending on the wrapped filters. This is
  525. fixed now, as a consequence the `or` and `and` filters are now deprecated in
  526. favour or `bool`.
  527. The `execution` option of the `terms` filter is now deprecated and ignored if
  528. provided.
  529. The `_cache` and `_cache_key` parameters of filters are deprecated in the REST
  530. layer and removed in the Java API. In case they are specified they will be
  531. ignored. Instead filters are always used as their own cache key and elasticsearch
  532. makes decisions by itself about whether it should cache filters based on how
  533. often they are used.
  534. Java plugins that register custom queries can do so by using the
  535. `IndicesQueriesModule#addQuery(Class<? extends QueryParser>)` method. Other
  536. ways to register custom queries are not supported anymore.
  537. ==== Query/filter merge
  538. Elasticsearch no longer makes a difference between queries and filters in the
  539. DSL; it detects when scores are not needed and automatically optimizes the
  540. query to not compute scores and optionally caches the result.
  541. As a consequence the `query` filter serves no purpose anymore and is deprecated.
  542. === Timezone for date field
  543. Specifying the `time_zone` parameter on queries or aggregations of `date` type fields
  544. must now be either an ISO 8601 UTC offset, or a timezone id. For example, the value
  545. `+1:00` must now be `+01:00`.
  546. === Snapshot and Restore
  547. Locations of the shared file system repositories and the URL repositories with `file:` URLs has to be now registered
  548. using `path.repo` setting. The `path.repo` setting can contain one or more repository locations:
  549. [source,yaml]
  550. ---------------
  551. path.repo: ["/mnt/daily", "/mnt/weekly"]
  552. ---------------
  553. If the repository location is specified as an absolute path it has to start with one of the locations
  554. specified in `path.repo`. If the location is specified as a relative path, it will be resolved against the first
  555. location specified in the `path.repo` setting.
  556. URL repositories with `http:`, `https:`, and `ftp:` URLs has to be whitelisted by specifying allowed URLs in the
  557. `repositories.url.allowed_urls` setting. This setting supports wildcards in the place of host, path, query, and
  558. fragment. For example:
  559. [source,yaml]
  560. -----------------------------------
  561. repositories.url.allowed_urls: ["http://www.example.org/root/*", "https://*.mydomain.com/*?*#*"]
  562. -----------------------------------
  563. The obsolete parameters `expand_wildcards_open` and `expand_wildcards_close` are no longer
  564. supported by the snapshot and restore operations. These parameters have been replaced by
  565. a single `expand_wildcards` parameter. See <<multi-index,the multi-index docs>> for more.
  566. === `_shutdown` API
  567. The `_shutdown` API has been removed without a replacement. Nodes should be managed via operating
  568. systems and the provided start/stop scripts.
  569. === Analyze API
  570. * The Analyze API return 0 as first Token's position instead of 1.
  571. * The `text()` method on `AnalyzeRequest` now returns `String[]` instead of `String`.
  572. === Multiple data.path striping
  573. Previously, if the `data.path` setting listed multiple data paths, then a
  574. shard would be ``striped'' across all paths by writing a whole file to each
  575. path in turn (in accordance with the `index.store.distributor` setting). The
  576. result was that the files from a single segment in a shard could be spread
  577. across multiple disks, and the failure of any one disk could corrupt multiple
  578. shards.
  579. This striping is no longer supported. Instead, different shards may be
  580. allocated to different paths, but all of the files in a single shard will be
  581. written to the same path.
  582. If striping is detected while starting Elasticsearch 2.0.0 or later, all of
  583. the files belonging to the same shard will be migrated to the same path. If
  584. there is not enough disk space to complete this migration, the upgrade will be
  585. cancelled and can only be resumed once enough disk space is made available.
  586. The `index.store.distributor` setting has also been removed.
  587. === Hunspell dictionary configuration
  588. The parameter `indices.analysis.hunspell.dictionary.location` has been removed,
  589. and `<path.conf>/hunspell` is always used.
  590. === Java API Transport API construction
  591. The `TransportClient` construction code has changed, it now uses the builder
  592. pattern. Instead of using:
  593. [source,java]
  594. --------------------------------------------------
  595. Settings settings = Settings.settingsBuilder()
  596. .put("cluster.name", "myClusterName").build();
  597. Client client = new TransportClient(settings);
  598. --------------------------------------------------
  599. Use:
  600. [source,java]
  601. --------------------------------------------------
  602. Settings settings = Settings.settingsBuilder()
  603. .put("cluster.name", "myClusterName").build();
  604. Client client = TransportClient.builder().settings(settings).build();
  605. --------------------------------------------------
  606. === Logging
  607. Log messages are now truncated at 10,000 characters. This can be changed in the
  608. `logging.yml` configuration file.
  609. [float]
  610. === Removed `top_children` query
  611. The `top_children` query has been removed in favour of the `has_child` query. The `top_children` query wasn't always faster
  612. than the `has_child` query and the `top_children` query was often inaccurate. The total hits and any aggregations in the
  613. same search request will likely be off if `top_children` was used.
  614. === Removed file based index templates
  615. Index templates can no longer be configured on disk. Use the `_template` API instead.
  616. [float]
  617. === Removed `id_cache` from stats apis
  618. Removed `id_cache` metric from nodes stats, indices stats and cluster stats apis. This metric has also been removed
  619. from the shards cat, indices cat and nodes cat apis. Parent/child memory is now reported under fielddata, because it
  620. has internally be using fielddata for a while now.
  621. To just see how much parent/child related field data is taking, the `fielddata_fields` option can be used on the stats
  622. apis. Indices stats example:
  623. [source,js]
  624. --------------------------------------------------
  625. curl -XGET "http://localhost:9200/_stats/fielddata?pretty&human&fielddata_fields=_parent"
  626. --------------------------------------------------
  627. Parent/child is using field data for the `_parent` field since version `1.1.0`, but the memory stats for the `_parent`
  628. field were still shown under `id_cache` metric in the stats apis for backwards compatible reasons between 1.x versions.
  629. Before version `1.1.0` the parent/child had its own in-memory data structures for id values in the `_parent` field.
  630. [float]
  631. === Removed `id_cache` from clear cache api
  632. Removed `id_cache` option from the clear cache apis. The `fielddata` option should be used to clear `_parent` field
  633. from fielddata.
  634. [float]
  635. === Highlighting
  636. The default value for the `require_field_match` option is `true` rather than
  637. `false`, meaning that the highlighters will take the fields that were queried
  638. into account by default. That means for instance that highlighting any field
  639. when querying the `_all` field will produce no highlighted snippets by default,
  640. given that the match was on the `_all` field only. Querying the same fields
  641. that need to be highlighted is the cleaner solution to get highlighted snippets
  642. back. Otherwise `require_field_match` option can be set to `false` to ignore
  643. field names completely when highlighting.
  644. The postings highlighter doesn't support the `require_field_match` option
  645. anymore, it will only highlight fields that were queried.
  646. The `match` query with type set to `match_phrase_prefix` is not supported by the
  647. postings highlighter. No highlighted snippets will be returned.
  648. [float]
  649. === Parent/child
  650. Parent/child has been rewritten completely to reduce memory usage and to execute
  651. `has_child` and `has_parent` queries faster and more efficient. The `_parent` field
  652. uses doc values by default. The refactored and improved implementation is only active
  653. for indices created on or after version 2.0.
  654. In order to benefit for all performance and memory improvements we recommend to reindex all
  655. indices that have the `_parent` field created before was upgraded to 2.0.
  656. The following breaks in backwards compatability have been made on indices with the `_parent` field
  657. created on or after clusters with version 2.0:
  658. * The `type` option on the `_parent` field can only point to a parent type that doesn't exist yet,
  659. so this means that an existing type/mapping can no longer become a parent type.
  660. * The `has_child` and `has_parent` queries can no longer be use in alias filters.
  661. === Meta fields returned under the top-level json object
  662. When selecting meta fields such as `_routing` or `_timestamp`, the field values
  663. are now directly put as a top-level property of the json objet, instead of being
  664. put under `fields` like regular stored fields.
  665. [source,sh]
  666. ---------------
  667. curl -XGET 'localhost:9200/test/_search?fields=_timestamp,foo'
  668. ---------------
  669. [source,js]
  670. ---------------
  671. {
  672. [...]
  673. "hits": {
  674. "total": 1,
  675. "max_score": 1,
  676. "hits": [
  677. {
  678. "_index": "test",
  679. "_type": "test",
  680. "_id": "1",
  681. "_score": 1,
  682. "_timestamp": 10000000,
  683. "fields": {
  684. "foo" : [ "bar" ]
  685. }
  686. }
  687. ]
  688. }
  689. }
  690. ---------------
  691. === Settings for resource watcher have been renamed
  692. The setting names for configuring the resource watcher have been renamed
  693. to prevent clashes with the watcher plugin
  694. * `watcher.enabled` is now `resource.reload.enabled`
  695. * `watcher.interval` is now `resource.reload.interval`
  696. * `watcher.interval.low` is now `resource.reload.interval.low`
  697. * `watcher.interval.medium` is now `resource.reload.interval.medium`
  698. * `watcher.interval.high` is now `resource.reload.interval.high`
  699. === Percolator stats
  700. Changed the `percolate.getTime` stat (total time spent on percolating) to `percolate.time` state.
  701. === Plugin Manager for official plugins
  702. Some of the elasticsearch official plugins have been moved to elasticsearch repository and will be released at the
  703. same time as elasticsearch itself, using the same version number.
  704. In that case, the plugin manager can now use a simpler form to identify an official plugin. Instead of:
  705. [source,sh]
  706. ---------------
  707. bin/plugin install elasticsearch/plugin_name/version
  708. ---------------
  709. You can use:
  710. [source,sh]
  711. ---------------
  712. bin/plugin install plugin_name
  713. ---------------
  714. The plugin manager will recognize this form and will be able to download the right version for your elasticsearch
  715. version.
  716. For older versions of elasticsearch, you still have to use the older form.
  717. For the record, official plugins which can use this new simplified form are:
  718. * elasticsearch-analysis-icu
  719. * elasticsearch-analysis-kuromoji
  720. * elasticsearch-analysis-phonetic
  721. * elasticsearch-analysis-smartcn
  722. * elasticsearch-analysis-stempel
  723. * elasticsearch-cloud-aws
  724. * elasticsearch-cloud-azure
  725. * elasticsearch-cloud-gce
  726. * elasticsearch-delete-by-query
  727. * elasticsearch-lang-javascript
  728. * elasticsearch-lang-python
  729. === `/bin/elasticsearch` version needs `-V` parameter
  730. Due to switching to elasticsearchs internal command line parsing
  731. infrastructure for the pluginmanager and the elasticsearch start up
  732. script, the `-v` parameter now stands for `--verbose`, where as `-V` or
  733. `--version` can be used to show the Elasticsearch version and exit.
  734. === `/bin/elasticsearch` dynamic parameters must come after static ones
  735. If you are setting configuration options like cluster name or node name via
  736. the commandline, you have to ensure, that the static options like pid file
  737. path or daemonizing always come first, like this
  738. ```
  739. /bin/elasticsearch -d -p /tmp/foo.pid --http.cors.enabled=true --http.cors.allow-origin='*'
  740. ```
  741. For a list of those static parameters, run `/bin/elasticsearch -h`
  742. === Aliases
  743. Fields used in alias filters no longer have to exist in the mapping upon alias creation time. Alias filters are now
  744. parsed at request time and then the fields in filters are resolved from the mapping, whereas before alias filters were
  745. parsed at alias creation time and the parsed form was kept around in memory.
  746. === _analyze API
  747. The `prefer_local` has been removed from the _analyze api. The _analyze api is a light operation and the caller shouldn't
  748. be concerned about whether it executes on the node that receives the request or another node.
  749. === Shadow replicas
  750. The `node.enable_custom_paths` setting has been removed and replaced by the
  751. `path.shared_data` setting to allow shadow replicas with custom paths to work
  752. with the security manager. For example, if your previous configuration had:
  753. ```
  754. node.enable_custom_paths: true
  755. ```
  756. And you created an index using shadow replicas with `index.data_path` set to
  757. `/opt/data/my_index` with the following:
  758. [source,js]
  759. --------------------------------------------------
  760. curl -XPUT 'localhost:9200/my_index' -d '
  761. {
  762. "index" : {
  763. "number_of_shards" : 1,
  764. "number_of_replicas" : 4,
  765. "data_path": "/opt/data/my_index",
  766. "shadow_replicas": true
  767. }
  768. }'
  769. --------------------------------------------------
  770. For 2.0, you will need to set `path.shared_data` to a parent directory of the
  771. index's data_path, so:
  772. ```
  773. path.shared_data: /opt/data
  774. ```