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