5 Bulk operations allow the client to bundle a number of actions into a single REST request.
\r
7 It is important to note that the individual operations bundled into a bulk request are considered by the Search Service to be completely independent operations. This has a few consequences:
\r
9 * No guarantees are made with respect to the order in which the individual operations will be processed by the document store.
\r
11 * There is no implied transactionality between the operations. The operations may succeed or fail independently of one another, and it is entirely possible to get back a result set indicating a mix of success and failure results for the individual operations.
\r
15 The request payload of a bulk operation must be structured in the following manner (we will flesh out this pseudo-json with a concrete example further down):
\r
18 { <operation> : { <meta-data>, <document> } },
\r
21 { <operation> : { <meta-data>, <document> } }
\r
25 The following table describes the operations which are supported as part of a _Bulk_ request:
\r
27 | Operation | Behaviour | Expected Meta Data | Expected Payload |
\r
28 | --------- | ---------------------------------------------- | ---------------------- | ----------------- |
\r
29 | create | Insert a new document into the document store. | document url | document contents |
\r
30 | update | Update an existing document. | document url, etag | document contents |
\r
31 | delete | Remove a document from the document store. | document url, etag | none |
\r
34 Depending on the operation being requested, certain additional meta-data is required for the _Search Date Service_ to be able to carry out the operation. These are described in the _operations_ table above.
\r
37 For those operations which involve creating or updating a _Document_, the contents of the document must be provided.
\r
39 _Example - Simple Bulk Request including all supported operations:_
\r
47 "url": "/indexes/my-index/documents/"
\r
58 "url": "/indexes/my-other-index/documents/3",
\r
62 "field1": "some-value"
\r
69 "url": "/indexes/my-index/documents/7"
\r
78 "total_operations": 3,
\r
79 "total_success": 2,
\r
83 "operation": "create",
\r
84 "url": "/services/search-data-service/v1/indexes/my-index/documents/1",
\r
86 "status-code": "409",
\r
87 "status-message": "[default][1]: document already exists"
\r
90 "operation": "update",
\r
91 "url": "/services/search-data-service/v1/indexes/my-other-index/documents/3",
\r
93 "status-code": "200", "status-message": "OK"
\r
96 "operation": "delete",
\r
97 "url": "/services/search-data-service/v1/indexes/my-index/documents/7",
\r
98 "status-code": "200", "status-message": "OK"
\r
105 **Submit A Bulk Operation**
\r
109 https://{host}:9509/services/search-data-service/v1/search/bulk/
\r
121 Accept = application/json
\r
122 X-TransactionId = Unique id set by client (for logging purposes)
\r
123 X-FromAppId = Application identifier (for logging purposes)
\r
124 Content-Type = application/json
\r
126 **Request Payload**
\r
128 Set of bulk operations to be executed (see Syntax Section)
\r
130 **Success Response**
\r
132 Code: 207 (Multi-Staltus)
\r
134 Body: JSON format result set which includes individual status codes for each requested operation.
\r
140 500 - Internal Error
\r