From cb31e591f1ca8c4eac0b31e64ac40b14aff3d51e Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Tue, 29 Mar 2016 11:43:27 +0200 Subject: [PATCH 1/7] Fix test bug in TypeQueryBuilderTests. --- .../elasticsearch/index/query/TypeQueryBuilderTests.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/test/java/org/elasticsearch/index/query/TypeQueryBuilderTests.java b/core/src/test/java/org/elasticsearch/index/query/TypeQueryBuilderTests.java index 674b6aed78a..ce8377439fc 100644 --- a/core/src/test/java/org/elasticsearch/index/query/TypeQueryBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/index/query/TypeQueryBuilderTests.java @@ -19,6 +19,7 @@ package org.elasticsearch.index.query; +import org.apache.lucene.search.MatchNoDocsQuery; import org.apache.lucene.search.Query; import org.apache.lucene.util.BytesRef; import org.elasticsearch.index.mapper.internal.TypeFieldMapper; @@ -34,7 +35,11 @@ public class TypeQueryBuilderTests extends AbstractQueryTestCase Date: Mon, 28 Mar 2016 12:18:19 +0200 Subject: [PATCH 2/7] Renamed update-by-query REST spec to update_by_query --- .../10_basic.yaml | 14 +++++++------- .../20_validation.yaml | 6 +++--- .../30_new_fields.yaml | 2 +- .../40_versioning.yaml | 4 ++-- .../50_consistency.yaml | 4 ++-- .../{update-by-query.json => update_by_query.json} | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) rename modules/reindex/src/test/resources/rest-api-spec/test/{update-by-query => update_by_query}/10_basic.yaml (96%) rename modules/reindex/src/test/resources/rest-api-spec/test/{update-by-query => update_by_query}/20_validation.yaml (92%) rename modules/reindex/src/test/resources/rest-api-spec/test/{update-by-query => update_by_query}/30_new_fields.yaml (97%) rename modules/reindex/src/test/resources/rest-api-spec/test/{update-by-query => update_by_query}/40_versioning.yaml (82%) rename modules/reindex/src/test/resources/rest-api-spec/test/{update-by-query => update_by_query}/50_consistency.yaml (95%) rename rest-api-spec/src/main/resources/rest-api-spec/api/{update-by-query.json => update_by_query.json} (99%) diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/10_basic.yaml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/10_basic.yaml similarity index 96% rename from modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/10_basic.yaml rename to modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/10_basic.yaml index 5b4df1c923d..083cb44d01f 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/10_basic.yaml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/10_basic.yaml @@ -10,7 +10,7 @@ indices.refresh: {} - do: - update-by-query: + update_by_query: index: test - is_false: timed_out - match: {updated: 1} @@ -35,7 +35,7 @@ indices.refresh: {} - do: - update-by-query: + update_by_query: wait_for_completion: false index: test - match: {task: '/.+:\d+/'} @@ -79,7 +79,7 @@ - do: catch: conflict - update-by-query: + update_by_query: index: test - match: {updated: 0} - match: {version_conflicts: 1} @@ -119,7 +119,7 @@ body: { "text": "test2" } - do: - update-by-query: + update_by_query: index: test conflicts: proceed - match: {updated: 0} @@ -148,7 +148,7 @@ indices.refresh: {} - do: - update-by-query: + update_by_query: index: twitter body: query: @@ -178,7 +178,7 @@ indices.refresh: {} - do: - update-by-query: + update_by_query: index: twitter size: 1 - match: {updated: 1} @@ -218,7 +218,7 @@ indices.refresh: {} - do: - update-by-query: + update_by_query: index: test scroll_size: 1 - match: {batches: 3} diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/20_validation.yaml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/20_validation.yaml similarity index 92% rename from modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/20_validation.yaml rename to modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/20_validation.yaml index f8cd16792e2..175ec65903a 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/20_validation.yaml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/20_validation.yaml @@ -8,7 +8,7 @@ body: { "text": "test" } - do: catch: /conflicts may only be .* but was \[cat\]/ - update-by-query: + update_by_query: index: test conflicts: cat @@ -22,7 +22,7 @@ body: { "text": "test" } - do: catch: /Failed to parse int parameter \[scroll_size\] with value \[cat\]/ - update-by-query: + update_by_query: index: test scroll_size: cat @@ -36,6 +36,6 @@ body: { "text": "test" } - do: catch: /size should be greater than 0 if the request is limited to some number of documents or -1 if it isn't but it was \[-4\]/ - update-by-query: + update_by_query: index: test size: -4 diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/30_new_fields.yaml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/30_new_fields.yaml similarity index 97% rename from modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/30_new_fields.yaml rename to modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/30_new_fields.yaml index 22612b7f71b..fc6141cae53 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/30_new_fields.yaml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/30_new_fields.yaml @@ -43,7 +43,7 @@ - match: { hits.total: 0 } - do: - update-by-query: + update_by_query: index: test - do: indices.refresh: {} diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/40_versioning.yaml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/40_versioning.yaml similarity index 82% rename from modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/40_versioning.yaml rename to modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/40_versioning.yaml index 24cbef1a25c..ac1cbe4417e 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/40_versioning.yaml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/40_versioning.yaml @@ -1,5 +1,5 @@ --- -"update-by-query increments the version number": +"update_by_query increments the version number": - do: index: index: test @@ -10,7 +10,7 @@ indices.refresh: {} - do: - update-by-query: + update_by_query: index: test - match: {updated: 1} - match: {version_conflicts: 0} diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/50_consistency.yaml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/50_consistency.yaml similarity index 95% rename from modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/50_consistency.yaml rename to modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/50_consistency.yaml index dc8e3dcb33e..96c1e70c89f 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/50_consistency.yaml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/50_consistency.yaml @@ -21,14 +21,14 @@ - do: catch: unavailable - update-by-query: + update_by_query: index: test timeout: 1s - match: failures.0.cause.reason: /Not.enough.active.copies.to.meet.write.consistency.of.\[QUORUM\].\(have.1,.needed.4\)..Timeout\:.\[1s\],.request:.\[BulkShardRequest.to.\[test\].containing.\[1\].requests\]/ - do: - update-by-query: + update_by_query: index: test consistency: one - match: {failures: []} diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/update-by-query.json b/rest-api-spec/src/main/resources/rest-api-spec/api/update_by_query.json similarity index 99% rename from rest-api-spec/src/main/resources/rest-api-spec/api/update-by-query.json rename to rest-api-spec/src/main/resources/rest-api-spec/api/update_by_query.json index fe7fdf8a840..e6048efd35d 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/update-by-query.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/update_by_query.json @@ -1,5 +1,5 @@ { - "update-by-query": { + "update_by_query": { "documentation": "https://www.elastic.co/guide/en/elasticsearch/plugins/master/plugins-reindex.html", "methods": ["POST"], "url": { From 579d976e90b25ef499331767f6b847c7226cc198 Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Mon, 28 Mar 2016 13:05:19 +0200 Subject: [PATCH 3/7] The source parameter should not be defined in the delete-by-query REST spec --- .../src/test/resources/rest-api-spec/api/delete_by_query.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/plugins/delete-by-query/src/test/resources/rest-api-spec/api/delete_by_query.json b/plugins/delete-by-query/src/test/resources/rest-api-spec/api/delete_by_query.json index 5b2fa006fa3..d8d4446a1b2 100644 --- a/plugins/delete-by-query/src/test/resources/rest-api-spec/api/delete_by_query.json +++ b/plugins/delete-by-query/src/test/resources/rest-api-spec/api/delete_by_query.json @@ -53,10 +53,6 @@ "type" : "string", "description" : "Specific routing value" }, - "source": { - "type" : "string", - "description" : "The URL-encoded query definition (instead of using the request body)" - }, "timeout": { "type" : "time", "description" : "Explicit operation timeout" From 647437ce56fb5f932ace940ad22d901853249736 Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Mon, 28 Mar 2016 13:14:48 +0200 Subject: [PATCH 4/7] REST: The body is required in the reindex API --- .../src/main/resources/rest-api-spec/api/reindex.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/reindex.json b/rest-api-spec/src/main/resources/rest-api-spec/api/reindex.json index bfe12c981dc..0dc0088dd5c 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/reindex.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/reindex.json @@ -34,7 +34,8 @@ } }, "body": { - "description": "The search definition using the Query DSL and the prototype for the index request." + "description": "The search definition using the Query DSL and the prototype for the index request.", + "required": true } } } From b87beeb05fa16a6c5f6729a24cd640aa48e4d66d Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Tue, 29 Mar 2016 13:13:49 +0200 Subject: [PATCH 5/7] Rename update-by-query REST tests to update_by_query --- .../60_with_ingest.yaml | 4 ++-- .../70_throttle.yaml | 2 +- .../10_script.yaml | 12 ++++++------ .../20_broken.yaml | 2 +- .../30_timeout.yaml | 2 +- .../40_search_failure.yaml | 2 +- .../resources/rest-api-spec/api/update_by_query.json | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) rename modules/reindex/src/test/resources/rest-api-spec/test/{update-by-query => update_by_query}/60_with_ingest.yaml (92%) rename modules/reindex/src/test/resources/rest-api-spec/test/{update-by-query => update_by_query}/70_throttle.yaml (97%) rename qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/{update-by-query => update_by_query}/10_script.yaml (94%) rename qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/{update-by-query => update_by_query}/20_broken.yaml (95%) rename qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/{update-by-query => update_by_query}/30_timeout.yaml (96%) rename qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/{update-by-query => update_by_query}/40_search_failure.yaml (97%) diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/60_with_ingest.yaml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/60_with_ingest.yaml similarity index 92% rename from modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/60_with_ingest.yaml rename to modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/60_with_ingest.yaml index 8c857bda5eb..faff5bd5b57 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/60_with_ingest.yaml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/60_with_ingest.yaml @@ -1,5 +1,5 @@ --- -"Update a document using update-by-query": +"Update a document using update_by_query": - do: ingest.put_pipeline: id: "test_ingest" @@ -25,7 +25,7 @@ indices.refresh: {} - do: - update-by-query: + update_by_query: index: twitter refresh: true pipeline: test_ingest diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/70_throttle.yaml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/70_throttle.yaml similarity index 97% rename from modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/70_throttle.yaml rename to modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/70_throttle.yaml index f0e75b8b2d5..7f9b7efce5c 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update-by-query/70_throttle.yaml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/70_throttle.yaml @@ -29,7 +29,7 @@ indices.refresh: {} - do: - update-by-query: + update_by_query: index: test scroll_size: 1 requests_per_second: 1 diff --git a/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update-by-query/10_script.yaml b/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update_by_query/10_script.yaml similarity index 94% rename from qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update-by-query/10_script.yaml rename to qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update_by_query/10_script.yaml index a5a8554615a..00c6e814eed 100644 --- a/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update-by-query/10_script.yaml +++ b/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update_by_query/10_script.yaml @@ -1,5 +1,5 @@ --- -"Update a document using update-by-query": +"Update a document using update_by_query": - do: index: index: twitter @@ -10,7 +10,7 @@ indices.refresh: {} - do: - update-by-query: + update_by_query: index: twitter refresh: true body: @@ -46,7 +46,7 @@ indices.refresh: {} - do: - update-by-query: + update_by_query: refresh: true index: twitter body: @@ -91,7 +91,7 @@ indices.refresh: {} - do: - update-by-query: + update_by_query: refresh: true index: twitter body: @@ -114,7 +114,7 @@ - do: catch: /Invalid fields added to ctx \[junk\]/ - update-by-query: + update_by_query: index: twitter body: script: @@ -133,7 +133,7 @@ - do: catch: /Modifying \[_id\] not allowed/ - update-by-query: + update_by_query: index: twitter body: script: diff --git a/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update-by-query/20_broken.yaml b/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update_by_query/20_broken.yaml similarity index 95% rename from qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update-by-query/20_broken.yaml rename to qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update_by_query/20_broken.yaml index c6134aef334..66f9cfe5456 100644 --- a/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update-by-query/20_broken.yaml +++ b/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update_by_query/20_broken.yaml @@ -11,7 +11,7 @@ - do: catch: request - update-by-query: + update_by_query: index: twitter refresh: true body: diff --git a/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update-by-query/30_timeout.yaml b/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update_by_query/30_timeout.yaml similarity index 96% rename from qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update-by-query/30_timeout.yaml rename to qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update_by_query/30_timeout.yaml index 2a291bf0541..e6bdd73757b 100644 --- a/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update-by-query/30_timeout.yaml +++ b/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update_by_query/30_timeout.yaml @@ -11,7 +11,7 @@ - do: catch: request_timeout - update-by-query: + update_by_query: index: twitter refresh: true search_timeout: 10ms diff --git a/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update-by-query/40_search_failure.yaml b/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update_by_query/40_search_failure.yaml similarity index 97% rename from qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update-by-query/40_search_failure.yaml rename to qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update_by_query/40_search_failure.yaml index 9b8ba43f4a8..748e5cd15e0 100644 --- a/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update-by-query/40_search_failure.yaml +++ b/qa/smoke-test-reindex-with-groovy/src/test/resources/rest-api-spec/test/update_by_query/40_search_failure.yaml @@ -11,7 +11,7 @@ - do: catch: request - update-by-query: + update_by_query: index: source body: query: diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/update_by_query.json b/rest-api-spec/src/main/resources/rest-api-spec/api/update_by_query.json index e6048efd35d..2409420fdd5 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/update_by_query.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/update_by_query.json @@ -192,7 +192,7 @@ "scroll_size": { "type": "integer", "defaut_value": 100, - "description": "Size on the scroll request powering the update-by-query" + "description": "Size on the scroll request powering the update_by_query" }, "wait_for_completion": { "type" : "boolean", From 978b24327e0daef7d2549259139ab082f51b4035 Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Tue, 29 Mar 2016 13:51:11 +0200 Subject: [PATCH 6/7] Docs: Included Nodes Task API and tidied reindex/update-by-query --- docs/reference/cluster.asciidoc | 2 + docs/reference/cluster/nodes-task.asciidoc | 49 ++++++++++++++++++++ docs/reference/docs/reindex.asciidoc | 45 +++++++++--------- docs/reference/docs/update-by-query.asciidoc | 14 +++--- docs/reference/tasks/list.asciidoc | 46 ------------------ 5 files changed, 83 insertions(+), 73 deletions(-) create mode 100644 docs/reference/cluster/nodes-task.asciidoc delete mode 100644 docs/reference/tasks/list.asciidoc diff --git a/docs/reference/cluster.asciidoc b/docs/reference/cluster.asciidoc index d294d1092b9..a42371b1054 100644 --- a/docs/reference/cluster.asciidoc +++ b/docs/reference/cluster.asciidoc @@ -45,6 +45,8 @@ include::cluster/nodes-stats.asciidoc[] include::cluster/nodes-info.asciidoc[] +include::cluster/nodes-task.asciidoc[] + include::cluster/nodes-hot-threads.asciidoc[] include::cluster/allocation-explain.asciidoc[] diff --git a/docs/reference/cluster/nodes-task.asciidoc b/docs/reference/cluster/nodes-task.asciidoc new file mode 100644 index 00000000000..85a8e758699 --- /dev/null +++ b/docs/reference/cluster/nodes-task.asciidoc @@ -0,0 +1,49 @@ +[[nodes-task]] +== Nodes Task API + +The nodes task management API retrieves information about the tasks currently +executing on one or more nodes in the cluster. + +[source,js] +-------------------------------------------------- +GET /_tasks <1> +GET /_tasks/nodeId1,nodeId2 <2> +GET /_tasks/nodeId1,nodeId2/cluster:* <3> +-------------------------------------------------- +// AUTOSENSE + +<1> Retrieves all tasks currently running on all nodes in the cluster. +<2> Retrieves all tasks running on nodes `nodeId1` and `nodeId2`. See <> for more info about how to select individual nodes. +<3> Retrieves all cluster-related tasks running on nodes `nodeId1` and `nodeId2`. + +The result will look similar to the following: + +[source,js] +-------------------------------------------------- +{ + "nodes": { + "fDlEl7PrQi6F-awHZ3aaDw": { + "name": "Gazer", + "transport_address": "127.0.0.1:9300", + "host": "127.0.0.1", + "ip": "127.0.0.1:9300", + "tasks": [ + { + "node": "fDlEl7PrQi6F-awHZ3aaDw", + "id": 105, + "type": "transport", + "action": "cluster:monitor/nodes/tasks" + }, + { + "node": "fDlEl7PrQi6F-awHZ3aaDw", + "id": 106, + "type": "direct", + "action": "cluster:monitor/nodes/tasks[n]", + "parent_node": "fDlEl7PrQi6F-awHZ3aaDw", + "parent_id": 105 + } + ] + } + } +} +-------------------------------------------------- diff --git a/docs/reference/docs/reindex.asciidoc b/docs/reference/docs/reindex.asciidoc index 5f4641ca187..fba45983521 100644 --- a/docs/reference/docs/reindex.asciidoc +++ b/docs/reference/docs/reindex.asciidoc @@ -1,8 +1,8 @@ [[docs-reindex]] == Reindex API -`_reindex`'s most basic form just copies documents from one index to another. -This will copy documents from `twitter` into `new_twitter`: +The most basic form of `_reindex` just copies documents from one index to another. +This will copy documents from the `twitter` index into the `new_twitter` index: [source,js] -------------------------------------------------- @@ -32,12 +32,13 @@ That will return something like this: } -------------------------------------------------- -Just like `_update_by_query`, `_reindex` gets a snapshot of the source index -but its target must be a **different** index so version conflicts are unlikely. -The `dest` element can be configured like the index API to control optimistic -concurrency control. Just leaving out `version_type` (as above) or setting it -to `internal` will cause Elasticsearch to blindly dump documents into the -target, overwriting any that happen to have the same type and id: +Just like <>, `_reindex` gets a +snapshot of the source index but its target must be a **different** index so +version conflicts are unlikely. The `dest` element can be configured like the +index API to control optimistic concurrency control. Just leaving out +`version_type` (as above) or setting it to `internal` will cause Elasticsearch +to blindly dump documents into the target, overwriting any that happen to have +the same type and id: [source,js] -------------------------------------------------- @@ -113,7 +114,7 @@ POST /_reindex // AUTOSENSE You can limit the documents by adding a type to the `source` or by adding a -query. This will only copy `tweet`s made by `kimchy` into `new_twitter`: +query. This will only copy ++tweet++'s made by `kimchy` into `new_twitter`: [source,js] -------------------------------------------------- @@ -140,9 +141,9 @@ lots of sources in one request. This will copy documents from the `tweet` and `post` types in the `twitter` and `blog` index. It'd include the `post` type in the `twitter` index and the `tweet` type in the `blog` index. If you want to be more specific you'll need to use the `query`. It also makes no effort to handle -id collisions. The target index will remain valid but it's not easy to predict +ID collisions. The target index will remain valid but it's not easy to predict which document will survive because the iteration order isn't well defined. -Just avoid that situation, ok? + [source,js] -------------------------------------------------- POST /_reindex @@ -222,14 +223,15 @@ POST /_reindex Think of the possibilities! Just be careful! With great power.... You can change: - * "_id" - * "_type" - * "_index" - * "_version" - * "_routing" - * "_parent" - * "_timestamp" - * "_ttl" + + * `_id` + * `_type` + * `_index` + * `_version` + * `_routing` + * `_parent` + * `_timestamp` + * `_ttl` Setting `_version` to `null` or clearing it from the `ctx` map is just like not sending the version in an indexing request. It will cause that document to be @@ -257,6 +259,7 @@ the `=`. For example, you can use the following request to copy all documents from the `source` index with the company name `cat` into the `dest` index with routing set to `cat`. + [source,js] -------------------------------------------------- POST /_reindex @@ -316,7 +319,7 @@ Elasticsearch log file. This will be fixed soon. `consistency` controls how many copies of a shard must respond to each write request. `timeout` controls how long each write request waits for unavailable shards to become available. Both work exactly how they work in the -{ref}/docs-bulk.html[Bulk API]. +<>. `requests_per_second` can be set to any decimal number (1.4, 6, 1000, etc) and throttle the number of requests per second that the reindex issues. The @@ -385,7 +388,7 @@ from aborting the operation. === Works with the Task API While Reindex is running you can fetch their status using the -{ref}/task/list.html[Task List APIs]: +<>: [source,js] -------------------------------------------------- diff --git a/docs/reference/docs/update-by-query.asciidoc b/docs/reference/docs/update-by-query.asciidoc index 52667bf79a8..eb6d80415fc 100644 --- a/docs/reference/docs/update-by-query.asciidoc +++ b/docs/reference/docs/update-by-query.asciidoc @@ -56,7 +56,7 @@ POST /twitter/tweet/_update_by_query?conflicts=proceed // AUTOSENSE You can also limit `_update_by_query` using the -{ref}/query-dsl.html[Query DSL]. This will update all documents from the +<>. This will update all documents from the `twitter` index for the user `kimchy`: [source,js] @@ -73,7 +73,7 @@ POST /twitter/_update_by_query?conflicts=proceed // AUTOSENSE <1> The query must be passed as a value to the `query` key, in the same -way as the {ref}/search-search.html[Search API]. You can also use the `q` +way as the <>. You can also use the `q` parameter in the same way as the search api. So far we've only been updating documents without changing their source. That @@ -81,6 +81,7 @@ is genuinely useful for things like <> but it's only half the fun. `_update_by_query` supports a `script` object to update the document. This will increment the `likes` field on all of kimchy's tweets: + [source,js] -------------------------------------------------- POST /twitter/_update_by_query @@ -97,7 +98,7 @@ POST /twitter/_update_by_query -------------------------------------------------- // AUTOSENSE -Just as in {ref}/docs-update.html[Update API] you can set `ctx.op = "noop"` if +Just as in <> you can set `ctx.op = "noop"` if your script decides that it doesn't have to make any changes. That will cause `_update_by_query` to omit that document from its updates. Setting `ctx.op` to anything else is an error. If you want to delete by a query you can use the @@ -167,7 +168,7 @@ the Elasticsearch log file. This will be fixed soon. `consistency` controls how many copies of a shard must respond to each write request. `timeout` controls how long each write request waits for unavailable shards to become available. Both work exactly how they work in the -{ref}/docs-bulk.html[Bulk API]. +<>. `requests_per_second` can be set to any decimal number (1.4, 6, 1000, etc) and throttle the number of requests per second that the update by query issues. The @@ -232,7 +233,7 @@ from aborting the operation. === Works with the Task API While Update By Query is running you can fetch their status using the -{ref}/task/list.html[Task List APIs]: +<>: [source,js] -------------------------------------------------- @@ -285,6 +286,7 @@ progress by adding the `updated`, `created`, and `deleted` fields. The request will finish when their sum is equal to the `total` field. +[float] [[picking-up-a-new-property]] === Pick up a new property @@ -379,4 +381,4 @@ POST test/_search?filter_path=hits.total } -------------------------------------------------- -Hurray! You can do the exact same thing when adding a field to a multifield. +You can do the exact same thing when adding a field to a multifield. diff --git a/docs/reference/tasks/list.asciidoc b/docs/reference/tasks/list.asciidoc deleted file mode 100644 index bfd7f12c43f..00000000000 --- a/docs/reference/tasks/list.asciidoc +++ /dev/null @@ -1,46 +0,0 @@ -[[tasks-list]] -== Tasks List - -The task management API allows to retrieve information about currently running tasks. - -[source,js] --------------------------------------------------- -curl -XGET 'http://localhost:9200/_tasks' -curl -XGET 'http://localhost:9200/_tasks/nodeId1,nodeId2' -curl -XGET 'http://localhost:9200/_tasks/nodeId1,nodeId2/cluster:*' --------------------------------------------------- - -The first command retrieves all tasks currently running on all nodes. -The second command selectively retrieves tasks from nodes -`nodeId1` and `nodeId2`. All the nodes selective options are explained -<>. -The third command retrieves all cluster-related tasks running on nodes `nodeId1` and `nodeId2`. - -The result will look similar to: - -[source,js] --------------------------------------------------- -{ - "nodes" : { - "fDlEl7PrQi6F-awHZ3aaDw" : { - "name" : "Gazer", - "transport_address" : "127.0.0.1:9300", - "host" : "127.0.0.1", - "ip" : "127.0.0.1:9300", - "tasks" : [ { - "node" : "fDlEl7PrQi6F-awHZ3aaDw", - "id" : 105, - "type" : "transport", - "action" : "cluster:monitor/nodes/tasks" - }, { - "node" : "fDlEl7PrQi6F-awHZ3aaDw", - "id" : 106, - "type" : "direct", - "action" : "cluster:monitor/nodes/tasks[n]", - "parent_node" : "fDlEl7PrQi6F-awHZ3aaDw", - "parent_id" : 105 - } ] - } - } -} --------------------------------------------------- From 5f24581de31ddcfb1228f93261b78e48515e25b0 Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Tue, 29 Mar 2016 14:09:59 +0200 Subject: [PATCH 7/7] The reindex body is now required, which changes the exception thrown by the REST test --- .../resources/rest-api-spec/test/reindex/20_validation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/reindex/20_validation.yaml b/modules/reindex/src/test/resources/rest-api-spec/test/reindex/20_validation.yaml index 8526e91217a..96e955f7bde 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/reindex/20_validation.yaml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/reindex/20_validation.yaml @@ -1,7 +1,7 @@ --- "no body fails": - do: - catch: /body required/ + catch: param reindex: {} ---