1
1
/*
2
2
* Manticore Search Client
3
3
*
4
- * Low-level client for Manticore Search.
4
+ * Low-level client for Manticore Search.
5
5
*
6
6
* API version: 1.0.0
7
7
8
8
*/
9
9
10
-
11
10
package manticoresearch
12
11
13
12
import (
27
26
type IndexApiService service
28
27
29
28
type ApiBulkRequest struct {
30
- ctx _context.Context
29
+ ctx _context.Context
31
30
ApiService * IndexApiService
32
- body * string
31
+ body * string
33
32
}
34
33
35
34
func (r ApiBulkRequest ) Body (body string ) ApiBulkRequest {
@@ -43,34 +42,34 @@ func (r ApiBulkRequest) Execute() (BulkResponse, *_nethttp.Response, GenericOpen
43
42
44
43
/*
45
44
* Bulk Bulk index operations
46
- * Sends multiple operatons like inserts, updates, replaces or deletes.
47
- For each operation it's object must have same format as in their dedicated method.
45
+ * Sends multiple operatons like inserts, updates, replaces or deletes.
46
+ For each operation it's object must have same format as in their dedicated method.
48
47
The method expects a raw string as the batch in NDJSON.
49
- Each operation object needs to be serialized to
50
- JSON and separated by endline (\n).
51
-
48
+ Each operation object needs to be serialized to
49
+ JSON and separated by endline (\n).
50
+
52
51
An example of raw input:
53
-
52
+
54
53
```
55
54
{"insert": {"index": "movies", "doc": {"plot": "A secret team goes to North Pole", "rating": 9.5, "language": [2, 3], "title": "This is an older movie", "lon": 51.99, "meta": {"keywords":["travel","ice"],"genre":["adventure"]}, "year": 1950, "lat": 60.4, "advise": "PG-13"}}}
56
55
\n
57
56
{"delete": {"index": "movies","id":700}}
58
57
```
59
-
58
+
60
59
Responds with an object telling whenever any errors occured and an array with status for each operation:
61
-
60
+
62
61
```
63
62
{'items':[{'update':{'_index':'products','_id':1,'result':'updated'}},{'update':{'_index':'products','_id':2,'result':'updated'}}],'errors':false}
64
63
```
65
-
64
+
66
65
67
66
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
68
67
* @return ApiBulkRequest
69
- */
68
+ */
70
69
func (a * IndexApiService ) Bulk (ctx _context.Context ) ApiBulkRequest {
71
70
return ApiBulkRequest {
72
71
ApiService : a ,
73
- ctx : ctx ,
72
+ ctx : ctx ,
74
73
}
75
74
}
76
75
@@ -149,13 +148,13 @@ func (a *IndexApiService) BulkExecute(r ApiBulkRequest) (BulkResponse, *_nethttp
149
148
body : localVarBody ,
150
149
error : localVarHTTPResponse .Status ,
151
150
}
152
- var v ErrorResponse
153
- err = a .client .decode (& v , localVarBody , localVarHTTPResponse .Header .Get ("Content-Type" ))
154
- if err != nil {
155
- newErr .error = err .Error ()
156
- return localVarReturnValue , localVarHTTPResponse , newErr
157
- }
158
- newErr .model = v
151
+ var v ErrorResponse
152
+ err = a .client .decode (& v , localVarBody , localVarHTTPResponse .Header .Get ("Content-Type" ))
153
+ if err != nil {
154
+ newErr .error = err .Error ()
155
+ return localVarReturnValue , localVarHTTPResponse , newErr
156
+ }
157
+ newErr .model = v
159
158
return localVarReturnValue , localVarHTTPResponse , newErr
160
159
}
161
160
@@ -172,8 +171,8 @@ func (a *IndexApiService) BulkExecute(r ApiBulkRequest) (BulkResponse, *_nethttp
172
171
}
173
172
174
173
type ApiDeleteRequest struct {
175
- ctx _context.Context
176
- ApiService * IndexApiService
174
+ ctx _context.Context
175
+ ApiService * IndexApiService
177
176
deleteDocumentRequest * DeleteDocumentRequest
178
177
}
179
178
@@ -203,19 +202,19 @@ Example of input to delete using a query:
203
202
```
204
203
205
204
The match query has same syntax as in for searching.
206
- Responds with an object telling how many documents got deleted:
205
+ Responds with an object telling how many documents got deleted:
207
206
208
207
```
209
208
{'_index':'products','updated':1}
210
209
```
211
210
212
211
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
213
212
* @return ApiDeleteRequest
214
- */
213
+ */
215
214
func (a * IndexApiService ) Delete (ctx _context.Context ) ApiDeleteRequest {
216
215
return ApiDeleteRequest {
217
216
ApiService : a ,
218
- ctx : ctx ,
217
+ ctx : ctx ,
219
218
}
220
219
}
221
220
@@ -294,13 +293,13 @@ func (a *IndexApiService) DeleteExecute(r ApiDeleteRequest) (DeleteResponse, *_n
294
293
body : localVarBody ,
295
294
error : localVarHTTPResponse .Status ,
296
295
}
297
- var v ErrorResponse
298
- err = a .client .decode (& v , localVarBody , localVarHTTPResponse .Header .Get ("Content-Type" ))
299
- if err != nil {
300
- newErr .error = err .Error ()
301
- return localVarReturnValue , localVarHTTPResponse , newErr
302
- }
303
- newErr .model = v
296
+ var v ErrorResponse
297
+ err = a .client .decode (& v , localVarBody , localVarHTTPResponse .Header .Get ("Content-Type" ))
298
+ if err != nil {
299
+ newErr .error = err .Error ()
300
+ return localVarReturnValue , localVarHTTPResponse , newErr
301
+ }
302
+ newErr .model = v
304
303
return localVarReturnValue , localVarHTTPResponse , newErr
305
304
}
306
305
@@ -317,8 +316,8 @@ func (a *IndexApiService) DeleteExecute(r ApiDeleteRequest) (DeleteResponse, *_n
317
316
}
318
317
319
318
type ApiInsertRequest struct {
320
- ctx _context.Context
321
- ApiService * IndexApiService
319
+ ctx _context.Context
320
+ ApiService * IndexApiService
322
321
insertDocumentRequest * InsertDocumentRequest
323
322
}
324
323
@@ -333,32 +332,32 @@ func (r ApiInsertRequest) Execute() (SuccessResponse, *_nethttp.Response, Generi
333
332
334
333
/*
335
334
* Insert Create a new document in an index
336
- * Insert a document.
335
+ * Insert a document.
337
336
Expects an object like:
338
-
337
+
339
338
```
340
339
{'index':'movies','id':701,'doc':{'title':'This is an old movie','plot':'A secret team goes to North Pole','year':1950,'rating':9.5,'lat':60.4,'lon':51.99,'advise':'PG-13','meta':'{"keywords":{"travel","ice"},"genre":{"adventure"}}','language':[2,3]}}
341
340
```
342
-
341
+
343
342
The document id can also be missing, in which case an autogenerated one will be used:
344
-
343
+
345
344
```
346
345
{'index':'movies','doc':{'title':'This is a new movie','plot':'A secret team goes to North Pole','year':2020,'rating':9.5,'lat':60.4,'lon':51.99,'advise':'PG-13','meta':'{"keywords":{"travel","ice"},"genre":{"adventure"}}','language':[2,3]}}
347
346
```
348
-
347
+
349
348
It responds with an object in format:
350
-
349
+
351
350
```
352
351
{'_index':'products','_id':701,'created':true,'result':'created','status':201}
353
352
```
354
353
355
354
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
356
355
* @return ApiInsertRequest
357
- */
356
+ */
358
357
func (a * IndexApiService ) Insert (ctx _context.Context ) ApiInsertRequest {
359
358
return ApiInsertRequest {
360
359
ApiService : a ,
361
- ctx : ctx ,
360
+ ctx : ctx ,
362
361
}
363
362
}
364
363
@@ -437,13 +436,13 @@ func (a *IndexApiService) InsertExecute(r ApiInsertRequest) (SuccessResponse, *_
437
436
body : localVarBody ,
438
437
error : localVarHTTPResponse .Status ,
439
438
}
440
- var v ErrorResponse
441
- err = a .client .decode (& v , localVarBody , localVarHTTPResponse .Header .Get ("Content-Type" ))
442
- if err != nil {
443
- newErr .error = err .Error ()
444
- return localVarReturnValue , localVarHTTPResponse , newErr
445
- }
446
- newErr .model = v
439
+ var v ErrorResponse
440
+ err = a .client .decode (& v , localVarBody , localVarHTTPResponse .Header .Get ("Content-Type" ))
441
+ if err != nil {
442
+ newErr .error = err .Error ()
443
+ return localVarReturnValue , localVarHTTPResponse , newErr
444
+ }
445
+ newErr .model = v
447
446
return localVarReturnValue , localVarHTTPResponse , newErr
448
447
}
449
448
@@ -460,8 +459,8 @@ func (a *IndexApiService) InsertExecute(r ApiInsertRequest) (SuccessResponse, *_
460
459
}
461
460
462
461
type ApiReplaceRequest struct {
463
- ctx _context.Context
464
- ApiService * IndexApiService
462
+ ctx _context.Context
463
+ ApiService * IndexApiService
465
464
insertDocumentRequest * InsertDocumentRequest
466
465
}
467
466
@@ -485,11 +484,11 @@ Responds with an object in format: <br/>
485
484
486
485
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
487
486
* @return ApiReplaceRequest
488
- */
487
+ */
489
488
func (a * IndexApiService ) Replace (ctx _context.Context ) ApiReplaceRequest {
490
489
return ApiReplaceRequest {
491
490
ApiService : a ,
492
- ctx : ctx ,
491
+ ctx : ctx ,
493
492
}
494
493
}
495
494
@@ -568,13 +567,13 @@ func (a *IndexApiService) ReplaceExecute(r ApiReplaceRequest) (SuccessResponse,
568
567
body : localVarBody ,
569
568
error : localVarHTTPResponse .Status ,
570
569
}
571
- var v ErrorResponse
572
- err = a .client .decode (& v , localVarBody , localVarHTTPResponse .Header .Get ("Content-Type" ))
573
- if err != nil {
574
- newErr .error = err .Error ()
575
- return localVarReturnValue , localVarHTTPResponse , newErr
576
- }
577
- newErr .model = v
570
+ var v ErrorResponse
571
+ err = a .client .decode (& v , localVarBody , localVarHTTPResponse .Header .Get ("Content-Type" ))
572
+ if err != nil {
573
+ newErr .error = err .Error ()
574
+ return localVarReturnValue , localVarHTTPResponse , newErr
575
+ }
576
+ newErr .model = v
578
577
return localVarReturnValue , localVarHTTPResponse , newErr
579
578
}
580
579
@@ -591,8 +590,8 @@ func (a *IndexApiService) ReplaceExecute(r ApiReplaceRequest) (SuccessResponse,
591
590
}
592
591
593
592
type ApiUpdateRequest struct {
594
- ctx _context.Context
595
- ApiService * IndexApiService
593
+ ctx _context.Context
594
+ ApiService * IndexApiService
596
595
updateDocumentRequest * UpdateDocumentRequest
597
596
}
598
597
@@ -618,22 +617,22 @@ And update by using a match query:
618
617
619
618
```
620
619
{'index':'movies','doc':{'rating':9.49},'query':{'bool':{'must':[{'query_string':'new movie'}]}}}
621
- ```
620
+ ```
622
621
623
622
The match query has same syntax as for searching.
624
- Responds with an object that tells how many documents where updated in format:
623
+ Responds with an object that tells how many documents where updated in format:
625
624
626
625
```
627
626
{'_index':'products','updated':1}
628
627
```
629
628
630
629
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
631
630
* @return ApiUpdateRequest
632
- */
631
+ */
633
632
func (a * IndexApiService ) Update (ctx _context.Context ) ApiUpdateRequest {
634
633
return ApiUpdateRequest {
635
634
ApiService : a ,
636
- ctx : ctx ,
635
+ ctx : ctx ,
637
636
}
638
637
}
639
638
@@ -712,13 +711,13 @@ func (a *IndexApiService) UpdateExecute(r ApiUpdateRequest) (UpdateResponse, *_n
712
711
body : localVarBody ,
713
712
error : localVarHTTPResponse .Status ,
714
713
}
715
- var v ErrorResponse
716
- err = a .client .decode (& v , localVarBody , localVarHTTPResponse .Header .Get ("Content-Type" ))
717
- if err != nil {
718
- newErr .error = err .Error ()
719
- return localVarReturnValue , localVarHTTPResponse , newErr
720
- }
721
- newErr .model = v
714
+ var v ErrorResponse
715
+ err = a .client .decode (& v , localVarBody , localVarHTTPResponse .Header .Get ("Content-Type" ))
716
+ if err != nil {
717
+ newErr .error = err .Error ()
718
+ return localVarReturnValue , localVarHTTPResponse , newErr
719
+ }
720
+ newErr .model = v
722
721
return localVarReturnValue , localVarHTTPResponse , newErr
723
722
}
724
723
0 commit comments