1 module elasticsearch.api.actions.delete_;
2 
3 import elasticsearch.api.parameters;
4 import elasticsearch.transport;
5 import elasticsearch.client;
6 
7 import vibe.http.common;
8 
9 /// Delete a single document.
10 ///
11 /// @example Delete a document
12 ///
13 ///     client.delete index: 'myindex', type: 'mytype', id: '1'
14 ///
15 /// @example Delete a document with specific routing
16 ///
17 ///     client.delete index: 'myindex', type: 'mytype', id: '1', routing: 'abc123'
18 ///
19 /// @option arguments [String] :id The document ID (*Required*)
20 /// @option arguments [Number,List] :ignore The list of HTTP errors to ignore; only `404` supported at the moment
21 /// @option arguments [String] :index The name of the index (*Required*)
22 /// @option arguments [String] :type The type of the document (*Required*)
23 /// @option arguments [String] :consistency Specific write consistency setting for the operation
24 ///                                         (options: one, quorum, all)
25 /// @option arguments [String] :parent ID of parent document
26 /// @option arguments [Boolean] :refresh Refresh the index after performing the operation
27 /// @option arguments [String] :replication Specific replication type (options: sync, async)
28 /// @option arguments [String] :routing Specific routing value
29 /// @option arguments [Time] :timeout Explicit operation timeout
30 /// @option arguments [Number] :version Explicit version number for concurrency control
31 /// @option arguments [String] :version_type Specific version type (options: internal, external, external_gte, force)
32 ///
33 /// @see http://elasticsearch.org/guide/reference/api/delete/
34 ///
35 Response delete_(Client client, ESParams arguments = ESParams()) {
36 	arguments.enforceParameter("index");
37 	arguments.enforceParameter("type");
38 
39 	auto params = arguments.validateAndExtract(
40 		"consistency", "parent", "refresh", "replication", "routing",
41 		"timeout", "version", "version_type"
42 		);
43 
44 	string[] path = [arguments["index"], arguments["type"], arguments["id"]];
45 	
46 	return client.performRequest(RequestMethod.DELETE, esPathify(path), params);
47 }
48 
49 /// ditto
50 Response delete_(Client client, string indexName, string type, string id, ESParams params = ESParams()) {
51 	params["index"] = indexName;
52 	params["type"] = type;
53 	params["id"] = id;
54 	
55 	return delete_(client, params);
56 }