Skip to content

Commit

Permalink
Delete api: remove broadcast delete if routing is missing when required
Browse files Browse the repository at this point in the history
This commit changes the behaviour of the delete api when processing a delete request that refers to a type that has routing set to required in the mapping, and the routing is missing in the request. Up until now the delete api sent a broadcast delete request to all of the shards that belong to the index, making sure that the document could be found although the routing value wasn't specified. This was probably not the best choice: if the routing is set to required, an error should be thrown instead.

A `RoutingMissingException` gets now thrown instead, like it happens in the same situation with every other api (index, update, get etc.). Last but not least, this change allows to get rid of a couple of `TransportAction`s, `Request`s and `Response`s and simplify the codebase.

Closes #9123
Closes #10136
  • Loading branch information
javanna committed Mar 20, 2015
1 parent 780fe57 commit 4348959
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 703 deletions.
6 changes: 6 additions & 0 deletions docs/reference/migration/migrate_2_0.asciidoc
Expand Up @@ -161,6 +161,12 @@ shards aren't being kept track of. From version 2.0 the stats in the `_shards` h
of an index. The http status code is left unchanged and is only based on failures that occurred while executing on
primary shards.

=== Delete api with missing routing when required

Delete api requires a routing value when deleting a document belonging to a type that has routing set to required in its
mapping, whereas previous elasticsearch versions would trigger a broadcast delete on all shards belonging to the index.
A `RoutingMissingException` is now thrown instead.

=== Mappings

* The setting `index.mapping.allow_type_wrapper` has been removed. Documents should always be sent without the type as the root element.
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/org/elasticsearch/action/ActionModule.java
Expand Up @@ -129,8 +129,6 @@
import org.elasticsearch.action.count.TransportCountAction;
import org.elasticsearch.action.delete.DeleteAction;
import org.elasticsearch.action.delete.TransportDeleteAction;
import org.elasticsearch.action.delete.TransportIndexDeleteAction;
import org.elasticsearch.action.delete.TransportShardDeleteAction;
import org.elasticsearch.action.deletebyquery.DeleteByQueryAction;
import org.elasticsearch.action.deletebyquery.TransportDeleteByQueryAction;
import org.elasticsearch.action.deletebyquery.TransportIndexDeleteByQueryAction;
Expand Down Expand Up @@ -282,8 +280,7 @@ protected void configure() {
TransportDfsOnlyAction.class);
registerAction(MultiTermVectorsAction.INSTANCE, TransportMultiTermVectorsAction.class,
TransportShardMultiTermsVectorAction.class);
registerAction(DeleteAction.INSTANCE, TransportDeleteAction.class,
TransportIndexDeleteAction.class, TransportShardDeleteAction.class);
registerAction(DeleteAction.INSTANCE, TransportDeleteAction.class);
registerAction(CountAction.INSTANCE, TransportCountAction.class);
registerAction(ExistsAction.INSTANCE, TransportExistsAction.class);
registerAction(SuggestAction.INSTANCE, TransportSuggestAction.class);
Expand Down

This file was deleted.

This file was deleted.

123 changes: 0 additions & 123 deletions src/main/java/org/elasticsearch/action/delete/ShardDeleteRequest.java

This file was deleted.

This file was deleted.

0 comments on commit 4348959

Please sign in to comment.