migrate_1_0.asciidoc 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. [[breaking-changes-1.0]]
  2. == Breaking changes in 1.0
  3. This section discusses the changes that you need to be aware of when migrating
  4. your application to Elasticsearch 1.0.
  5. === System and settings
  6. * Elasticsearch now runs in the foreground by default. There is no more `-f`
  7. flag on the command line. Instead, to run elasticsearch as a daemon, use
  8. the `-d` flag:
  9. [source,sh]
  10. ---------------
  11. ./bin/elasticsearch -d
  12. ---------------
  13. * Command line settings can now be passed without the `-Des.` prefix, for
  14. instance:
  15. [source,sh]
  16. ---------------
  17. ./bin/elasticsearch --node.name=search_1 --cluster.name=production
  18. ---------------
  19. * Elasticsearch on 64 bit Linux now uses <<mmapfs,`mmapfs`>> by default. Make
  20. sure that you set <<setup-service,`MAX_MAP_COUNT`>> to a sufficiently high
  21. number. The RPM and Debian packages default this value to `262144`.
  22. * The RPM and Debian packages no longer start Elasticsearch by default.
  23. * The `cluster.routing.allocation` settings (`disable_allocation`,
  24. `disable_new_allocation` and `disable_replica_location`) have been
  25. <<modules-cluster,replaced by the single setting>>:
  26. +
  27. [source,yaml]
  28. ---------------
  29. cluster.routing.allocation.enable: all|primaries|new_primaries|none
  30. ---------------
  31. === Stats and Info APIs
  32. The <<cluster-state,`cluster_state`>>, <<cluster-nodes-info,`nodes_info`>>,
  33. <<cluster-nodes-stats,`nodes_stats`>> and <<indices-stats,`indices_stats`>>
  34. APIs have all been changed to make their format more RESTful and less clumsy.
  35. For instance, if you just want the `nodes` section of the the `cluster_state`,
  36. instead of:
  37. [source,sh]
  38. ---------------
  39. GET /_cluster/state?filter_metadata&filter_routing_table&filter_blocks
  40. ---------------
  41. you now use:
  42. [source,sh]
  43. ---------------
  44. GET /_cluster/state/nodes
  45. ---------------
  46. Similarly for the `nodes_stats` API, if you want the `transport` and `http`
  47. metrics only, instead of:
  48. [source,sh]
  49. ---------------
  50. GET /_nodes/stats?clear&transport&http
  51. ---------------
  52. you now use:
  53. [source,sh]
  54. ---------------
  55. GET /_nodes/stats/transport,http
  56. ---------------
  57. See the links above for full details.
  58. === Indices APIs
  59. The `mapping`, `alias`, `settings`, and `warmer` index APIs are all similar
  60. but there are subtle differences in the order of the URL and the response
  61. body. For instance, adding a mapping and a warmer look slightly different:
  62. [source,sh]
  63. ---------------
  64. PUT /{index}/{type}/_mapping
  65. PUT /{index}/_warmer/{name}
  66. ---------------
  67. These URLs have been unified as:
  68. [source,sh]
  69. ---------------
  70. PUT /{indices}/_mapping/{type}
  71. PUT /{indices}/_alias/{name}
  72. PUT /{indices}/_warmer/{name}
  73. GET /{indices}/_mapping/{types}
  74. GET /{indices}/_alias/{names}
  75. GET /{indices}/_settings/{names}
  76. GET /{indices}/_warmer/{names}
  77. DELETE /{indices}/_mapping/{types}
  78. DELETE /{indices}/_alias/{names}
  79. DELETE /{indices}/_warmer/{names}
  80. ---------------
  81. All of the `{indices}`, `{types}` and `{names}` parameters can be replaced by:
  82. * `_all`, `*` or blank (ie left out altogether), all of which mean ``all''
  83. * wildcards like `test*`
  84. * comma-separated lists: `index_1,test_*`
  85. The only exception is `DELETE` which doesn't accept blank (missing)
  86. parameters. If you want to delete something, you should be specific.
  87. Similarly, the return values for `GET` have been unified with the following
  88. rules:
  89. * Only return values that exist. If you try to `GET` a mapping which doesn't
  90. exist, then the result will be an empty object: `{}`. We no longer throw a
  91. `404` if the requested mapping/warmer/alias/setting doesn't exist.
  92. * The response format always has the index name, then the section, then the
  93. element name, for instance:
  94. +
  95. [source,js]
  96. ---------------
  97. {
  98. "my_index": {
  99. "mappings": {
  100. "my_type": {...}
  101. }
  102. }
  103. }
  104. ---------------
  105. +
  106. This is a breaking change for the `get_mapping` API.
  107. In the future we will also provide plural versions to allow putting multiple mappings etc in a single request.
  108. See <<indices-put-mapping,`put-mapping`>>, <<indices-get-mapping,`get-
  109. mapping`>>, <<indices-get-field-mapping,`get-field-mapping`>>,
  110. <<indices-update-settings,`update-settings`>>, <<indices-get-settings,`get-settings`>>,
  111. <<indices-warmers,`warmers`>>, and <<indices-aliases,`aliases`>> for more details.
  112. === Index request
  113. Previously a document could be indexed as itself, or wrapped in an outer
  114. object which specified the `type` name:
  115. [source,js]
  116. ---------------
  117. PUT /my_index/my_type/1
  118. {
  119. "my_type": {
  120. ... doc fields ...
  121. }
  122. }
  123. ---------------
  124. This led to some ambiguity when a document also included a field with the same
  125. name as the `type`. We no longer accept the outer `type` wrapper, but this
  126. behaviour can be reenabled on an index-by-index basis with the setting:
  127. `index.mapping.allow_type_wrapper`.
  128. === Search requests
  129. While the `search` API takes a top-level `query` parameter, the
  130. <<search-count,`count`>>, `delete-by-query` and
  131. <<search-validate,`validate-query`>> requests expected the whole body to be a
  132. query. These now _require_ a top-level `query` parameter:
  133. [source,js]
  134. ---------------
  135. GET /_count
  136. {
  137. "query": {
  138. "match": {
  139. "title": "Interesting stuff"
  140. }
  141. }
  142. }
  143. ---------------
  144. Also, the top-level `filter` parameter in search has been renamed to
  145. <<search-request-post-filter,`post_filter`>>, to indicate that it should not
  146. be used as the primary way to filter search results (use a
  147. <<query-dsl-bool-query,`bool` query>> instead), but only to filter
  148. results AFTER aggregations have been calculated.
  149. This example counts the top colors in all matching docs, but only returns docs
  150. with color `red`:
  151. [source,js]
  152. ---------------
  153. GET /_search
  154. {
  155. "query": {
  156. "match_all": {}
  157. },
  158. "aggs": {
  159. "colors": {
  160. "terms": { "field": "color" }
  161. }
  162. },
  163. "post_filter": {
  164. "term": {
  165. "color": "red"
  166. }
  167. }
  168. }
  169. ---------------
  170. === Multi-fields
  171. Multi-fields are dead! Long live multi-fields! Well, the field type
  172. `multi_field` has been removed. Instead, any of the core field types
  173. (excluding `object` and `nested`) now accept a `fields` parameter. It's the
  174. same thing, but nicer. Instead of:
  175. [source,js]
  176. ---------------
  177. "title": {
  178. "type": "multi_field",
  179. "fields": {
  180. "title": { "type": "string" },
  181. "raw": { "type": "string", "index": "not_analyzed" }
  182. }
  183. }
  184. ---------------
  185. you can now write:
  186. [source,js]
  187. ---------------
  188. "title": {
  189. "type": "string",
  190. "fields": {
  191. "raw": { "type": "string", "index": "not_analyzed" }
  192. }
  193. }
  194. ---------------
  195. Existing multi-fields will be upgraded to the new format automatically.
  196. Also, instead of having to use the arcane `path` and `index_name` parameters
  197. in order to index multiple fields into a single ``custom +_all+ field'', you
  198. can now use the <<copy-to,`copy_to` parameter>>.
  199. === Stopwords
  200. Previously, the <<analysis-standard-analyzer,`standard`>> and
  201. <<analysis-pattern-analyzer,`pattern`>> analyzers used the list of English stopwords
  202. by default, which caused some hard to debug indexing issues. Now they are set to
  203. use the empty stopwords list (ie `_none_`) instead.
  204. === Dates without years
  205. When dates are specified without a year, for example: `Dec 15 10:00:00` they
  206. are treated as dates in 2000 during indexing and range searches... except for
  207. the upper included bound `lte` where they were treated as dates in 1970! Now,
  208. all https://github.com/elasticsearch/elasticsearch/issues/4451[dates without years]
  209. use `1970` as the default.
  210. === Parameters
  211. * Geo queries used to use `miles` as the default unit. And we
  212. http://en.wikipedia.org/wiki/Mars_Climate_Orbiter[all know what
  213. happened at NASA] because of that decision. The new default unit is
  214. https://github.com/elasticsearch/elasticsearch/issues/4515[`meters`].
  215. * For all queries that support _fuzziness_, the `min_similarity`, `fuzziness`
  216. and `edit_distance` parameters have been unified as the single parameter
  217. `fuzziness`. See <<fuzziness>> for details of accepted values.
  218. * The `ignore_missing` parameter has been replaced by the `expand_wildcards`,
  219. `ignore_unavailable` and `allow_no_indices` parameters, all of which have
  220. sensible defaults. See <<multi-index,the multi-index docs>> for more.
  221. * An index name (or pattern) is now required for destructive operations like
  222. deleting indices:
  223. +
  224. [source,sh]
  225. ---------------
  226. # v0.90 - delete all indices:
  227. DELETE /
  228. # v1.0 - delete all indices:
  229. DELETE /_all
  230. DELETE /*
  231. ---------------
  232. +
  233. Setting `action.destructive_requires_name` to `true` provides further safety
  234. by disabling wildcard expansion on destructive actions.
  235. === Return values
  236. * The `ok` return value has been removed from all response bodies as it added
  237. no useful information.
  238. * The `found`, `not_found` and `exists` return values have been unified as
  239. `found` on all relevant APIs.
  240. * Field values, in response to the <<search-request-fields,`fields`>>
  241. parameter, are now always returned as arrays. A field could have single or
  242. multiple values, which meant that sometimes they were returned as scalars
  243. and sometimes as arrays. By always returning arrays, this simplifies user
  244. code. The only exception to this rule is when `fields` is used to retrieve
  245. metadata like the `routing` value, which are always singular. Metadata
  246. fields are always returned as scalars.
  247. +
  248. The `fields` parameter is intended to be used for retrieving stored fields,
  249. rather than for fields extracted from the `_source`. That means that it can no
  250. longer be used to return whole objects and it no longer accepts the
  251. `_source.fieldname` format. For these you should use the
  252. <<search-request-source-filtering,`_source`&#32; `_source_include` and `_source_exclude`>>
  253. parameters instead.
  254. * Settings, like `index.analysis.analyzer.default` are now returned as proper
  255. nested JSON objects, which makes them easier to work with programatically:
  256. +
  257. [source,js]
  258. ---------------
  259. {
  260. "index": {
  261. "analysis": {
  262. "analyzer": {
  263. "default": xxx
  264. }
  265. }
  266. }
  267. }
  268. ---------------
  269. +
  270. You can choose to return them in flattened format by passing `?flat_settings`
  271. in the query string.
  272. * The <<indices-analyze,`analyze`>> API no longer supports the text response
  273. format, but does support JSON and YAML.
  274. === Deprecations
  275. * The `text` query has been removed. Use the
  276. <<query-dsl-match-query,`match`>> query instead.
  277. * The `field` query has been removed. Use the
  278. <<query-dsl-query-string-query,`query_string`>> query instead.
  279. * Per-document boosting with the `_boost` field has
  280. been removed. You can use the
  281. <<query-dsl-function-score-query,`function_score`>> instead.
  282. * The `path` parameter in mappings has been deprecated. Use the
  283. <<copy-to,`copy_to`>> parameter instead.
  284. * The `custom_score` and `custom_boost_score` is no longer supported. You can
  285. use <<query-dsl-function-score-query,`function_score`>> instead.
  286. === Percolator
  287. The percolator has been redesigned and because of this the dedicated `_percolator` index is no longer used by the percolator,
  288. but instead the percolator works with a dedicated `.percolator` type. Read the http://www.elastic.co/blog/percolator-redesign-blog-post[redesigned percolator]
  289. blog post for the reasons why the percolator has been redesigned.
  290. Elasticsearch will *not* delete the `_percolator` index when upgrading, only the percolate api will not use the queries
  291. stored in the `_percolator` index. In order to use the already stored queries, you can just re-index the queries from the
  292. `_percolator` index into any index under the reserved `.percolator` type. The format in which the percolate queries
  293. were stored has *not* been changed. So a simple script that does a scan search to retrieve all the percolator queries
  294. and then does a bulk request into another index should be sufficient.