manticore-client 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +39 -0
- data/.openapi-generator/FILES +149 -0
- data/.openapi-generator/VERSION +1 -0
- data/.openapi-generator-ignore +5 -0
- data/.rspec +2 -0
- data/.rubocop.yml +160 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +103 -0
- data/LICENSE.txt +21 -0
- data/README.md +136 -0
- data/Rakefile +10 -0
- data/docs/AggComposite.md +20 -0
- data/docs/AggCompositeSource.md +18 -0
- data/docs/AggCompositeTerm.md +18 -0
- data/docs/AggTerms.md +20 -0
- data/docs/Aggregation.md +22 -0
- data/docs/AutocompleteRequest.md +22 -0
- data/docs/BoolFilter.md +22 -0
- data/docs/BulkResponse.md +26 -0
- data/docs/DeleteDocumentRequest.md +24 -0
- data/docs/DeleteResponse.md +26 -0
- data/docs/ErrorResponse.md +20 -0
- data/docs/FulltextFilter.md +24 -0
- data/docs/GeoDistance.md +24 -0
- data/docs/GeoDistanceLocationAnchor.md +20 -0
- data/docs/Highlight.md +62 -0
- data/docs/HighlightAllOfFields.md +15 -0
- data/docs/HighlightFieldOption.md +26 -0
- data/docs/HitsHits.md +22 -0
- data/docs/IndexApi.md +401 -0
- data/docs/InsertDocumentRequest.md +24 -0
- data/docs/Join.md +24 -0
- data/docs/JoinCond.md +22 -0
- data/docs/JoinOn.md +22 -0
- data/docs/KnnQuery.md +28 -0
- data/docs/Match.md +22 -0
- data/docs/MatchAll.md +18 -0
- data/docs/PercolateRequest.md +18 -0
- data/docs/PercolateRequestQuery.md +18 -0
- data/docs/QueryFilter.md +34 -0
- data/docs/Range.md +24 -0
- data/docs/ReplaceDocumentRequest.md +18 -0
- data/docs/ResponseError.md +49 -0
- data/docs/ResponseErrorDetails.md +22 -0
- data/docs/SearchApi.md +204 -0
- data/docs/SearchQuery.md +36 -0
- data/docs/SearchRequest.md +46 -0
- data/docs/SearchResponse.md +30 -0
- data/docs/SearchResponseHits.md +24 -0
- data/docs/SourceRules.md +20 -0
- data/docs/SqlResponse.md +49 -0
- data/docs/SuccessResponse.md +28 -0
- data/docs/UpdateDocumentRequest.md +26 -0
- data/docs/UpdateResponse.md +24 -0
- data/docs/UtilsApi.md +76 -0
- data/lib/manticore/client/api/index_api.rb +442 -0
- data/lib/manticore/client/api/search_api.rb +232 -0
- data/lib/manticore/client/api/utils_api.rb +93 -0
- data/lib/manticore/client/api_client.rb +437 -0
- data/lib/manticore/client/api_error.rb +58 -0
- data/lib/manticore/client/configuration.rb +385 -0
- data/lib/manticore/client/models/agg_composite.rb +233 -0
- data/lib/manticore/client/models/agg_composite_source.rb +238 -0
- data/lib/manticore/client/models/agg_composite_term.rb +239 -0
- data/lib/manticore/client/models/agg_terms.rb +249 -0
- data/lib/manticore/client/models/aggregation.rb +240 -0
- data/lib/manticore/client/models/autocomplete_request.rb +276 -0
- data/lib/manticore/client/models/bool_filter.rb +247 -0
- data/lib/manticore/client/models/bulk_response.rb +264 -0
- data/lib/manticore/client/models/delete_document_request.rb +269 -0
- data/lib/manticore/client/models/delete_response.rb +262 -0
- data/lib/manticore/client/models/error_response.rb +250 -0
- data/lib/manticore/client/models/fulltext_filter.rb +252 -0
- data/lib/manticore/client/models/geo_distance.rb +306 -0
- data/lib/manticore/client/models/geo_distance_location_anchor.rb +232 -0
- data/lib/manticore/client/models/highlight.rb +525 -0
- data/lib/manticore/client/models/highlight_all_of_fields.rb +105 -0
- data/lib/manticore/client/models/highlight_field_option.rb +262 -0
- data/lib/manticore/client/models/hits_hits.rb +242 -0
- data/lib/manticore/client/models/insert_document_request.rb +286 -0
- data/lib/manticore/client/models/join.rb +327 -0
- data/lib/manticore/client/models/join_cond.rb +276 -0
- data/lib/manticore/client/models/join_on.rb +272 -0
- data/lib/manticore/client/models/knn_query.rb +307 -0
- data/lib/manticore/client/models/match.rb +290 -0
- data/lib/manticore/client/models/match_all.rb +262 -0
- data/lib/manticore/client/models/percolate_request.rb +238 -0
- data/lib/manticore/client/models/percolate_request_query.rb +238 -0
- data/lib/manticore/client/models/query_filter.rb +307 -0
- data/lib/manticore/client/models/range.rb +252 -0
- data/lib/manticore/client/models/replace_document_request.rb +239 -0
- data/lib/manticore/client/models/response_error.rb +105 -0
- data/lib/manticore/client/models/response_error_details.rb +261 -0
- data/lib/manticore/client/models/search_query.rb +316 -0
- data/lib/manticore/client/models/search_request.rb +382 -0
- data/lib/manticore/client/models/search_response.rb +281 -0
- data/lib/manticore/client/models/search_response_hits.rb +254 -0
- data/lib/manticore/client/models/source_rules.rb +236 -0
- data/lib/manticore/client/models/sql_response.rb +106 -0
- data/lib/manticore/client/models/success_response.rb +272 -0
- data/lib/manticore/client/models/update_document_request.rb +296 -0
- data/lib/manticore/client/models/update_response.rb +252 -0
- data/lib/manticore/client/version.rb +7 -0
- data/lib/manticore/client.rb +32 -0
- data/lib/manticore-client.rb +3 -0
- data/manticore-client.gemspec +34 -0
- data/spec/api/index_api_spec.rb +179 -0
- data/spec/api/search_api_spec.rb +94 -0
- data/spec/api/utils_api_spec.rb +100 -0
- data/spec/spec_helper.rb +92 -0
- data/spec/support/manticore_sql_helper.rb +33 -0
- metadata +218 -0
@@ -0,0 +1,442 @@
|
|
1
|
+
=begin
|
2
|
+
#Manticore Search Client
|
3
|
+
|
4
|
+
#Сlient for Manticore Search.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 5.0.0
|
7
|
+
Contact: info@manticoresearch.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.13.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module Manticore::Client
|
16
|
+
class IndexApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Bulk table operations
|
23
|
+
# Sends multiple operatons like inserts, updates, replaces or deletes. For each operation it's object must have same format as in their dedicated method. The method expects a raw string as the batch in NDJSON. Each operation object needs to be serialized to JSON and separated by endline (\\n). An example of raw input: ``` {\"insert\": {\"table\": \"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\"}}} \\n {\"delete\": {\"table\": \"movies\",\"id\":700}} ``` Responds with an object telling whenever any errors occured and an array with status for each operation: ``` { 'items': [ { 'update':{'table':'products','id':1,'result':'updated'} }, { 'update':{'table':'products','id':2,'result':'updated'} } ], 'errors':false } ```
|
24
|
+
# @param body [String]
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [BulkResponse]
|
27
|
+
def bulk(body, opts = {})
|
28
|
+
data, _status_code, _headers = bulk_with_http_info(body, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Bulk table operations
|
33
|
+
# Sends multiple operatons like inserts, updates, replaces or deletes. For each operation it's object must have same format as in their dedicated method. The method expects a raw string as the batch in NDJSON. Each operation object needs to be serialized to JSON and separated by endline (\\n). An example of raw input: ``` {\"insert\": {\"table\": \"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\"}}} \\n {\"delete\": {\"table\": \"movies\",\"id\":700}} ``` Responds with an object telling whenever any errors occured and an array with status for each operation: ``` { 'items': [ { 'update':{'table':'products','id':1,'result':'updated'} }, { 'update':{'table':'products','id':2,'result':'updated'} } ], 'errors':false } ```
|
34
|
+
# @param body [String]
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(BulkResponse, Integer, Hash)>] BulkResponse data, response status code and response headers
|
37
|
+
def bulk_with_http_info(body, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: IndexApi.bulk ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'body' is set
|
42
|
+
if @api_client.config.client_side_validation && body.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'body' when calling IndexApi.bulk"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/bulk'
|
47
|
+
|
48
|
+
# query parameters
|
49
|
+
query_params = opts[:query_params] || {}
|
50
|
+
|
51
|
+
# header parameters
|
52
|
+
header_params = opts[:header_params] || {}
|
53
|
+
# HTTP header 'Accept' (if needed)
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
55
|
+
# HTTP header 'Content-Type'
|
56
|
+
content_type = @api_client.select_header_content_type(['application/x-ndjson'])
|
57
|
+
if !content_type.nil?
|
58
|
+
header_params['Content-Type'] = content_type
|
59
|
+
end
|
60
|
+
|
61
|
+
# form parameters
|
62
|
+
form_params = opts[:form_params] || {}
|
63
|
+
|
64
|
+
# http body (model)
|
65
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
|
66
|
+
|
67
|
+
# return_type
|
68
|
+
return_type = opts[:debug_return_type] || 'BulkResponse'
|
69
|
+
|
70
|
+
# auth_names
|
71
|
+
auth_names = opts[:debug_auth_names] || []
|
72
|
+
|
73
|
+
new_options = opts.merge(
|
74
|
+
:operation => :"IndexApi.bulk",
|
75
|
+
:header_params => header_params,
|
76
|
+
:query_params => query_params,
|
77
|
+
:form_params => form_params,
|
78
|
+
:body => post_body,
|
79
|
+
:auth_names => auth_names,
|
80
|
+
:return_type => return_type
|
81
|
+
)
|
82
|
+
|
83
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
84
|
+
if @api_client.config.debugging
|
85
|
+
@api_client.config.logger.debug "API called: IndexApi#bulk\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
86
|
+
end
|
87
|
+
return data, status_code, headers
|
88
|
+
end
|
89
|
+
|
90
|
+
# Delete a document in a table
|
91
|
+
# Delete one or several documents. The method has 2 ways of deleting: either by id, in case only one document is deleted or by using a match query, in which case multiple documents can be delete . Example of input to delete by id: ``` {'table':'movies','id':100} ``` Example of input to delete using a query: ``` { 'table':'movies', 'query': { 'bool': { 'must': [ {'query_string':'new movie'} ] } } } ``` The match query has same syntax as in for searching. Responds with an object telling how many documents got deleted: ``` {'table':'products','updated':1} ```
|
92
|
+
# @param delete_document_request [DeleteDocumentRequest]
|
93
|
+
# @param [Hash] opts the optional parameters
|
94
|
+
# @return [DeleteResponse]
|
95
|
+
def delete(delete_document_request, opts = {})
|
96
|
+
data, _status_code, _headers = delete_with_http_info(delete_document_request, opts)
|
97
|
+
data
|
98
|
+
end
|
99
|
+
|
100
|
+
# Delete a document in a table
|
101
|
+
# Delete one or several documents. The method has 2 ways of deleting: either by id, in case only one document is deleted or by using a match query, in which case multiple documents can be delete . Example of input to delete by id: ``` {'table':'movies','id':100} ``` Example of input to delete using a query: ``` { 'table':'movies', 'query': { 'bool': { 'must': [ {'query_string':'new movie'} ] } } } ``` The match query has same syntax as in for searching. Responds with an object telling how many documents got deleted: ``` {'table':'products','updated':1} ```
|
102
|
+
# @param delete_document_request [DeleteDocumentRequest]
|
103
|
+
# @param [Hash] opts the optional parameters
|
104
|
+
# @return [Array<(DeleteResponse, Integer, Hash)>] DeleteResponse data, response status code and response headers
|
105
|
+
def delete_with_http_info(delete_document_request, opts = {})
|
106
|
+
if @api_client.config.debugging
|
107
|
+
@api_client.config.logger.debug 'Calling API: IndexApi.delete ...'
|
108
|
+
end
|
109
|
+
# verify the required parameter 'delete_document_request' is set
|
110
|
+
if @api_client.config.client_side_validation && delete_document_request.nil?
|
111
|
+
fail ArgumentError, "Missing the required parameter 'delete_document_request' when calling IndexApi.delete"
|
112
|
+
end
|
113
|
+
# resource path
|
114
|
+
local_var_path = '/delete'
|
115
|
+
|
116
|
+
# query parameters
|
117
|
+
query_params = opts[:query_params] || {}
|
118
|
+
|
119
|
+
# header parameters
|
120
|
+
header_params = opts[:header_params] || {}
|
121
|
+
# HTTP header 'Accept' (if needed)
|
122
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
123
|
+
# HTTP header 'Content-Type'
|
124
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
125
|
+
if !content_type.nil?
|
126
|
+
header_params['Content-Type'] = content_type
|
127
|
+
end
|
128
|
+
|
129
|
+
# form parameters
|
130
|
+
form_params = opts[:form_params] || {}
|
131
|
+
|
132
|
+
# http body (model)
|
133
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(delete_document_request)
|
134
|
+
|
135
|
+
# return_type
|
136
|
+
return_type = opts[:debug_return_type] || 'DeleteResponse'
|
137
|
+
|
138
|
+
# auth_names
|
139
|
+
auth_names = opts[:debug_auth_names] || []
|
140
|
+
|
141
|
+
new_options = opts.merge(
|
142
|
+
:operation => :"IndexApi.delete",
|
143
|
+
:header_params => header_params,
|
144
|
+
:query_params => query_params,
|
145
|
+
:form_params => form_params,
|
146
|
+
:body => post_body,
|
147
|
+
:auth_names => auth_names,
|
148
|
+
:return_type => return_type
|
149
|
+
)
|
150
|
+
|
151
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
152
|
+
if @api_client.config.debugging
|
153
|
+
@api_client.config.logger.debug "API called: IndexApi#delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
154
|
+
end
|
155
|
+
return data, status_code, headers
|
156
|
+
end
|
157
|
+
|
158
|
+
# Create a new document in a table
|
159
|
+
# Insert a document. Expects an object like: ``` { 'table':'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] } } ``` The document id can also be missing, in which case an autogenerated one will be used: ``` { 'table':'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] } } ``` It responds with an object in format: ``` {'table':'products','id':701,'created':true,'result':'created','status':201} ```
|
160
|
+
# @param insert_document_request [InsertDocumentRequest]
|
161
|
+
# @param [Hash] opts the optional parameters
|
162
|
+
# @return [SuccessResponse]
|
163
|
+
def insert(insert_document_request, opts = {})
|
164
|
+
data, _status_code, _headers = insert_with_http_info(insert_document_request, opts)
|
165
|
+
data
|
166
|
+
end
|
167
|
+
|
168
|
+
# Create a new document in a table
|
169
|
+
# Insert a document. Expects an object like: ``` { 'table':'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] } } ``` The document id can also be missing, in which case an autogenerated one will be used: ``` { 'table':'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] } } ``` It responds with an object in format: ``` {'table':'products','id':701,'created':true,'result':'created','status':201} ```
|
170
|
+
# @param insert_document_request [InsertDocumentRequest]
|
171
|
+
# @param [Hash] opts the optional parameters
|
172
|
+
# @return [Array<(SuccessResponse, Integer, Hash)>] SuccessResponse data, response status code and response headers
|
173
|
+
def insert_with_http_info(insert_document_request, opts = {})
|
174
|
+
if @api_client.config.debugging
|
175
|
+
@api_client.config.logger.debug 'Calling API: IndexApi.insert ...'
|
176
|
+
end
|
177
|
+
# verify the required parameter 'insert_document_request' is set
|
178
|
+
if @api_client.config.client_side_validation && insert_document_request.nil?
|
179
|
+
fail ArgumentError, "Missing the required parameter 'insert_document_request' when calling IndexApi.insert"
|
180
|
+
end
|
181
|
+
# resource path
|
182
|
+
local_var_path = '/insert'
|
183
|
+
|
184
|
+
# query parameters
|
185
|
+
query_params = opts[:query_params] || {}
|
186
|
+
|
187
|
+
# header parameters
|
188
|
+
header_params = opts[:header_params] || {}
|
189
|
+
# HTTP header 'Accept' (if needed)
|
190
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
191
|
+
# HTTP header 'Content-Type'
|
192
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
193
|
+
if !content_type.nil?
|
194
|
+
header_params['Content-Type'] = content_type
|
195
|
+
end
|
196
|
+
|
197
|
+
# form parameters
|
198
|
+
form_params = opts[:form_params] || {}
|
199
|
+
|
200
|
+
# http body (model)
|
201
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(insert_document_request)
|
202
|
+
|
203
|
+
# return_type
|
204
|
+
return_type = opts[:debug_return_type] || 'SuccessResponse'
|
205
|
+
|
206
|
+
# auth_names
|
207
|
+
auth_names = opts[:debug_auth_names] || []
|
208
|
+
|
209
|
+
new_options = opts.merge(
|
210
|
+
:operation => :"IndexApi.insert",
|
211
|
+
:header_params => header_params,
|
212
|
+
:query_params => query_params,
|
213
|
+
:form_params => form_params,
|
214
|
+
:body => post_body,
|
215
|
+
:auth_names => auth_names,
|
216
|
+
:return_type => return_type
|
217
|
+
)
|
218
|
+
|
219
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
220
|
+
if @api_client.config.debugging
|
221
|
+
@api_client.config.logger.debug "API called: IndexApi#insert\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
222
|
+
end
|
223
|
+
return data, status_code, headers
|
224
|
+
end
|
225
|
+
|
226
|
+
# Partially replaces a document in a table
|
227
|
+
# Partially replaces a document with given id in a table Responds with an object of the following format: ``` {'table':'products','updated':1} ```
|
228
|
+
# @param table [String] Name of the percolate table
|
229
|
+
# @param id [Integer] Id of the document to replace
|
230
|
+
# @param replace_document_request [ReplaceDocumentRequest]
|
231
|
+
# @param [Hash] opts the optional parameters
|
232
|
+
# @return [UpdateResponse]
|
233
|
+
def partial_replace(table, id, replace_document_request, opts = {})
|
234
|
+
data, _status_code, _headers = partial_replace_with_http_info(table, id, replace_document_request, opts)
|
235
|
+
data
|
236
|
+
end
|
237
|
+
|
238
|
+
# Partially replaces a document in a table
|
239
|
+
# Partially replaces a document with given id in a table Responds with an object of the following format: ``` {'table':'products','updated':1} ```
|
240
|
+
# @param table [String] Name of the percolate table
|
241
|
+
# @param id [Integer] Id of the document to replace
|
242
|
+
# @param replace_document_request [ReplaceDocumentRequest]
|
243
|
+
# @param [Hash] opts the optional parameters
|
244
|
+
# @return [Array<(UpdateResponse, Integer, Hash)>] UpdateResponse data, response status code and response headers
|
245
|
+
def partial_replace_with_http_info(table, id, replace_document_request, opts = {})
|
246
|
+
if @api_client.config.debugging
|
247
|
+
@api_client.config.logger.debug 'Calling API: IndexApi.partial_replace ...'
|
248
|
+
end
|
249
|
+
# verify the required parameter 'table' is set
|
250
|
+
if @api_client.config.client_side_validation && table.nil?
|
251
|
+
fail ArgumentError, "Missing the required parameter 'table' when calling IndexApi.partial_replace"
|
252
|
+
end
|
253
|
+
# verify the required parameter 'id' is set
|
254
|
+
if @api_client.config.client_side_validation && id.nil?
|
255
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling IndexApi.partial_replace"
|
256
|
+
end
|
257
|
+
# verify the required parameter 'replace_document_request' is set
|
258
|
+
if @api_client.config.client_side_validation && replace_document_request.nil?
|
259
|
+
fail ArgumentError, "Missing the required parameter 'replace_document_request' when calling IndexApi.partial_replace"
|
260
|
+
end
|
261
|
+
# resource path
|
262
|
+
local_var_path = '/{table}/_update/{id}'.sub('{' + 'table' + '}', CGI.escape(table.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
|
263
|
+
|
264
|
+
# query parameters
|
265
|
+
query_params = opts[:query_params] || {}
|
266
|
+
|
267
|
+
# header parameters
|
268
|
+
header_params = opts[:header_params] || {}
|
269
|
+
# HTTP header 'Accept' (if needed)
|
270
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
271
|
+
# HTTP header 'Content-Type'
|
272
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
273
|
+
if !content_type.nil?
|
274
|
+
header_params['Content-Type'] = content_type
|
275
|
+
end
|
276
|
+
|
277
|
+
# form parameters
|
278
|
+
form_params = opts[:form_params] || {}
|
279
|
+
|
280
|
+
# http body (model)
|
281
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(replace_document_request)
|
282
|
+
|
283
|
+
# return_type
|
284
|
+
return_type = opts[:debug_return_type] || 'UpdateResponse'
|
285
|
+
|
286
|
+
# auth_names
|
287
|
+
auth_names = opts[:debug_auth_names] || []
|
288
|
+
|
289
|
+
new_options = opts.merge(
|
290
|
+
:operation => :"IndexApi.partial_replace",
|
291
|
+
:header_params => header_params,
|
292
|
+
:query_params => query_params,
|
293
|
+
:form_params => form_params,
|
294
|
+
:body => post_body,
|
295
|
+
:auth_names => auth_names,
|
296
|
+
:return_type => return_type
|
297
|
+
)
|
298
|
+
|
299
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
300
|
+
if @api_client.config.debugging
|
301
|
+
@api_client.config.logger.debug "API called: IndexApi#partial_replace\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
302
|
+
end
|
303
|
+
return data, status_code, headers
|
304
|
+
end
|
305
|
+
|
306
|
+
# Replace new document in a table
|
307
|
+
# Replace an existing document. Input has same format as `insert` operation. Responds with an object in format: ``` {'table':'products','id':1,'created':false,'result':'updated','status':200} ```
|
308
|
+
# @param insert_document_request [InsertDocumentRequest]
|
309
|
+
# @param [Hash] opts the optional parameters
|
310
|
+
# @return [SuccessResponse]
|
311
|
+
def replace(insert_document_request, opts = {})
|
312
|
+
data, _status_code, _headers = replace_with_http_info(insert_document_request, opts)
|
313
|
+
data
|
314
|
+
end
|
315
|
+
|
316
|
+
# Replace new document in a table
|
317
|
+
# Replace an existing document. Input has same format as `insert` operation. Responds with an object in format: ``` {'table':'products','id':1,'created':false,'result':'updated','status':200} ```
|
318
|
+
# @param insert_document_request [InsertDocumentRequest]
|
319
|
+
# @param [Hash] opts the optional parameters
|
320
|
+
# @return [Array<(SuccessResponse, Integer, Hash)>] SuccessResponse data, response status code and response headers
|
321
|
+
def replace_with_http_info(insert_document_request, opts = {})
|
322
|
+
if @api_client.config.debugging
|
323
|
+
@api_client.config.logger.debug 'Calling API: IndexApi.replace ...'
|
324
|
+
end
|
325
|
+
# verify the required parameter 'insert_document_request' is set
|
326
|
+
if @api_client.config.client_side_validation && insert_document_request.nil?
|
327
|
+
fail ArgumentError, "Missing the required parameter 'insert_document_request' when calling IndexApi.replace"
|
328
|
+
end
|
329
|
+
# resource path
|
330
|
+
local_var_path = '/replace'
|
331
|
+
|
332
|
+
# query parameters
|
333
|
+
query_params = opts[:query_params] || {}
|
334
|
+
|
335
|
+
# header parameters
|
336
|
+
header_params = opts[:header_params] || {}
|
337
|
+
# HTTP header 'Accept' (if needed)
|
338
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
339
|
+
# HTTP header 'Content-Type'
|
340
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
341
|
+
if !content_type.nil?
|
342
|
+
header_params['Content-Type'] = content_type
|
343
|
+
end
|
344
|
+
|
345
|
+
# form parameters
|
346
|
+
form_params = opts[:form_params] || {}
|
347
|
+
|
348
|
+
# http body (model)
|
349
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(insert_document_request)
|
350
|
+
|
351
|
+
# return_type
|
352
|
+
return_type = opts[:debug_return_type] || 'SuccessResponse'
|
353
|
+
|
354
|
+
# auth_names
|
355
|
+
auth_names = opts[:debug_auth_names] || []
|
356
|
+
|
357
|
+
new_options = opts.merge(
|
358
|
+
:operation => :"IndexApi.replace",
|
359
|
+
:header_params => header_params,
|
360
|
+
:query_params => query_params,
|
361
|
+
:form_params => form_params,
|
362
|
+
:body => post_body,
|
363
|
+
:auth_names => auth_names,
|
364
|
+
:return_type => return_type
|
365
|
+
)
|
366
|
+
|
367
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
368
|
+
if @api_client.config.debugging
|
369
|
+
@api_client.config.logger.debug "API called: IndexApi#replace\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
370
|
+
end
|
371
|
+
return data, status_code, headers
|
372
|
+
end
|
373
|
+
|
374
|
+
# Update a document in a table
|
375
|
+
# Update one or several documents. The update can be made by passing the id or by using a match query in case multiple documents can be updated. For example update a document using document id: ``` {'table':'movies','doc':{'rating':9.49},'id':100} ``` And update by using a match query: ``` { 'table':'movies', 'doc':{'rating':9.49}, 'query': { 'bool': { 'must': [ {'query_string':'new movie'} ] } } } ``` The match query has same syntax as for searching. Responds with an object that tells how many documents where updated in format: ``` {'table':'products','updated':1} ```
|
376
|
+
# @param update_document_request [UpdateDocumentRequest]
|
377
|
+
# @param [Hash] opts the optional parameters
|
378
|
+
# @return [UpdateResponse]
|
379
|
+
def update(update_document_request, opts = {})
|
380
|
+
data, _status_code, _headers = update_with_http_info(update_document_request, opts)
|
381
|
+
data
|
382
|
+
end
|
383
|
+
|
384
|
+
# Update a document in a table
|
385
|
+
# Update one or several documents. The update can be made by passing the id or by using a match query in case multiple documents can be updated. For example update a document using document id: ``` {'table':'movies','doc':{'rating':9.49},'id':100} ``` And update by using a match query: ``` { 'table':'movies', 'doc':{'rating':9.49}, 'query': { 'bool': { 'must': [ {'query_string':'new movie'} ] } } } ``` The match query has same syntax as for searching. Responds with an object that tells how many documents where updated in format: ``` {'table':'products','updated':1} ```
|
386
|
+
# @param update_document_request [UpdateDocumentRequest]
|
387
|
+
# @param [Hash] opts the optional parameters
|
388
|
+
# @return [Array<(UpdateResponse, Integer, Hash)>] UpdateResponse data, response status code and response headers
|
389
|
+
def update_with_http_info(update_document_request, opts = {})
|
390
|
+
if @api_client.config.debugging
|
391
|
+
@api_client.config.logger.debug 'Calling API: IndexApi.update ...'
|
392
|
+
end
|
393
|
+
# verify the required parameter 'update_document_request' is set
|
394
|
+
if @api_client.config.client_side_validation && update_document_request.nil?
|
395
|
+
fail ArgumentError, "Missing the required parameter 'update_document_request' when calling IndexApi.update"
|
396
|
+
end
|
397
|
+
# resource path
|
398
|
+
local_var_path = '/update'
|
399
|
+
|
400
|
+
# query parameters
|
401
|
+
query_params = opts[:query_params] || {}
|
402
|
+
|
403
|
+
# header parameters
|
404
|
+
header_params = opts[:header_params] || {}
|
405
|
+
# HTTP header 'Accept' (if needed)
|
406
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
407
|
+
# HTTP header 'Content-Type'
|
408
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
409
|
+
if !content_type.nil?
|
410
|
+
header_params['Content-Type'] = content_type
|
411
|
+
end
|
412
|
+
|
413
|
+
# form parameters
|
414
|
+
form_params = opts[:form_params] || {}
|
415
|
+
|
416
|
+
# http body (model)
|
417
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(update_document_request)
|
418
|
+
|
419
|
+
# return_type
|
420
|
+
return_type = opts[:debug_return_type] || 'UpdateResponse'
|
421
|
+
|
422
|
+
# auth_names
|
423
|
+
auth_names = opts[:debug_auth_names] || []
|
424
|
+
|
425
|
+
new_options = opts.merge(
|
426
|
+
:operation => :"IndexApi.update",
|
427
|
+
:header_params => header_params,
|
428
|
+
:query_params => query_params,
|
429
|
+
:form_params => form_params,
|
430
|
+
:body => post_body,
|
431
|
+
:auth_names => auth_names,
|
432
|
+
:return_type => return_type
|
433
|
+
)
|
434
|
+
|
435
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
436
|
+
if @api_client.config.debugging
|
437
|
+
@api_client.config.logger.debug "API called: IndexApi#update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
438
|
+
end
|
439
|
+
return data, status_code, headers
|
440
|
+
end
|
441
|
+
end
|
442
|
+
end
|