|
1 | 1 | using Newtonsoft.Json;
|
| 2 | +using System.Collections.Generic; |
2 | 3 |
|
3 | 4 | namespace Nest
|
4 | 5 | {
|
| 6 | + // TODO: For backwards compatibility, this class acts as the response object |
| 7 | + // for both delete and delete by query requests, even though their actual responses |
| 8 | + // are completely different. For 2.0, we should move the delete by query specific |
| 9 | + // properties to a separate object (DeleteByQueryResponse). |
| 10 | + // See: https://github.com/elasticsearch/elasticsearch-net/issues/1146 |
5 | 11 | public interface IDeleteResponse : IResponse
|
6 | 12 | {
|
| 13 | + /// <summary> |
| 14 | + /// The ID of the deleted document. |
| 15 | + /// NOTE: This property only applies to delete requests and will be |
| 16 | + /// null for delete by query. |
| 17 | + /// </summary> |
7 | 18 | string Id { get; }
|
| 19 | + |
| 20 | + /// <summary> |
| 21 | + /// The index of the deleted document. |
| 22 | + /// NOTE: This property only applies to delete requests and will be |
| 23 | + /// null for delete by query. |
| 24 | + /// </summary> |
8 | 25 | string Index { get; }
|
| 26 | + |
| 27 | + /// <summary> |
| 28 | + /// The type of the deleted document. |
| 29 | + /// NOTE: This property only applies to delete requests and will be |
| 30 | + /// null for delete by query. |
| 31 | + /// </summary> |
9 | 32 | string Type { get; }
|
| 33 | + |
| 34 | + /// <summary> |
| 35 | + /// The version of the deleted document. |
| 36 | + /// NOTE: This property only applies to delete requests and will be |
| 37 | + /// null for delete by query. |
| 38 | + /// </summary> |
10 | 39 | string Version { get; }
|
| 40 | + |
| 41 | + /// <summary> |
| 42 | + /// Whether or not the document was found and deleted from the index. |
| 43 | + /// NOTE: This property only applies to delete requests and will be |
| 44 | + /// false for delete by query. |
| 45 | + /// </summary> |
11 | 46 | bool Found { get; }
|
| 47 | + |
| 48 | + #region DeleteByQuery properties |
| 49 | + |
| 50 | + /// <summary> |
| 51 | + /// The delete by query details for each affected index. |
| 52 | + /// NOTE: This property only applies to delete by query requests and |
| 53 | + /// will be null for delete requests. |
| 54 | + /// </summary> |
| 55 | + IDictionary<string, DeleteByQueryIndices> Indices { get; set; } |
| 56 | + |
| 57 | + #endregion |
12 | 58 | }
|
13 | 59 |
|
| 60 | + |
14 | 61 | [JsonObject]
|
15 | 62 | public class DeleteResponse : BaseResponse, IDeleteResponse
|
16 | 63 | {
|
17 | 64 | [JsonProperty("_index")]
|
18 | 65 | public string Index { get; internal set; }
|
| 66 | + |
19 | 67 | [JsonProperty("_type")]
|
20 | 68 | public string Type { get; internal set; }
|
| 69 | + |
21 | 70 | [JsonProperty("_id")]
|
22 | 71 | public string Id { get; internal set; }
|
| 72 | + |
23 | 73 | [JsonProperty("_version")]
|
24 | 74 | public string Version { get; internal set; }
|
| 75 | + |
25 | 76 | [JsonProperty("found")]
|
26 | 77 | public bool Found { get; internal set; }
|
| 78 | + |
| 79 | + [JsonProperty("_indices")] |
| 80 | + [JsonConverter(typeof(DictionaryKeysAreNotPropertyNamesJsonConverter))] |
| 81 | + public IDictionary<string, DeleteByQueryIndices> Indices { get; set; } |
| 82 | + } |
27 | 83 |
|
| 84 | + [JsonObject] |
| 85 | + public class DeleteByQueryIndices |
| 86 | + { |
| 87 | + [JsonProperty("_shards")] |
| 88 | + public ShardsMetaData Shards { get; set; } |
28 | 89 | }
|
29 | 90 | }
|
0 commit comments