migrate_1_0.asciidoc 12 KB

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