Class: Algolia::SearchClient

Inherits:
Object
  • Object
show all
Defined in:
lib/algolia/api/search_client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = nil) ⇒ SearchClient

Returns a new instance of SearchClient.



7
8
9
10
11
12
13
# File 'lib/algolia/api/search_client.rb', line 7

def initialize(config = nil)
  raise '`config` is missing.' if config.nil?
  raise '`app_id` is missing.' if config.app_id.nil? || config.app_id == ''
  raise '`api_key` is missing.' if config.api_key.nil? || config.api_key == ''

  @api_client = Algolia::ApiClient.new(config)
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



5
6
7
# File 'lib/algolia/api/search_client.rb', line 5

def api_client
  @api_client
end

Class Method Details

.create(app_id, api_key, opts = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/algolia/api/search_client.rb', line 15

def self.create(app_id, api_key, opts = {})
  hosts = []

  hosts << Transport::StatefulHost.new("#{app_id}-dsn.algolia.net", accept: CallType::READ)
  hosts << Transport::StatefulHost.new("#{app_id}.algolia.net", accept: CallType::WRITE)

  hosts += 1.upto(3).map do |i|
    Transport::StatefulHost.new("#{app_id}-#{i}.algolianet.com", accept: CallType::READ | CallType::WRITE)
  end.shuffle

  config = Algolia::Configuration.new(app_id, api_key, hosts, 'Search', opts)
  create_with_config(config)
end

.create_with_config(config) ⇒ Object



29
30
31
# File 'lib/algolia/api/search_client.rb', line 29

def self.create_with_config(config)
  new(config)
end

Instance Method Details

#add_api_key(api_key, request_options = {}) ⇒ AddApiKeyResponse

Add API key. Add a new API key with specific permissions and restrictions. The request must be authenticated with the admin API key. The response returns an API key string.

Parameters:

  • api_key (ApiKey)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (AddApiKeyResponse)


68
69
70
71
# File 'lib/algolia/api/search_client.rb', line 68

def add_api_key(api_key, request_options = {})
  response = add_api_key_with_http_info(api_key, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::AddApiKeyResponse')
end

#add_api_key_with_http_info(api_key, request_options = {}) ⇒ Http::Response

Add API key. Add a new API key with specific permissions and restrictions. The request must be authenticated with the admin API key. The response returns an API key string.

Parameters:

  • api_key (ApiKey)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/algolia/api/search_client.rb', line 38

def add_api_key_with_http_info(api_key, request_options = {})
  # verify the required parameter 'api_key' is set
  if @api_client.config.client_side_validation && api_key.nil?
    raise ArgumentError, "Parameter `api_key` is required when calling `add_api_key`."
  end

  path = '/1/keys'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(api_key)

  new_options = request_options.merge(
    :operation => :'SearchClient.add_api_key',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#add_or_update_object(index_name, object_id, body, request_options = {}) ⇒ UpdatedAtWithObjectIdResponse

Add or update a record (using objectID). If you use an existing ‘objectID`, the existing record will be replaced with the new one. To update only some attributes of an existing record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique record (object) identifier. (required)

  • body (Object)

    Algolia record. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdatedAtWithObjectIdResponse)


121
122
123
124
# File 'lib/algolia/api/search_client.rb', line 121

def add_or_update_object(index_name, object_id, body, request_options = {})
  response = add_or_update_object_with_http_info(index_name, object_id, body, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdatedAtWithObjectIdResponse')
end

#add_or_update_object_with_http_info(index_name, object_id, body, request_options = {}) ⇒ Http::Response

Add or update a record (using objectID). If you use an existing &#x60;objectID&#x60;, the existing record will be replaced with the new one. To update only some attributes of an existing record, use the [&#x60;partial&#x60; operation](#tag/Records/operation/partialUpdateObject) instead. To add multiple records to your index in a single API request, use the [&#x60;batch&#x60; operation](#tag/Records/operation/batch).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique record (object) identifier. (required)

  • body (Object)

    Algolia record. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/algolia/api/search_client.rb', line 80

def add_or_update_object_with_http_info(index_name, object_id, body, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `add_or_update_object`."
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    raise ArgumentError, "Parameter `object_id` is required when calling `add_or_update_object`."
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    raise ArgumentError, "Parameter `body` is required when calling `add_or_update_object`."
  end

  path = '/1/indexes/{indexName}/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}',
                                                                                                                       @api_client.encode_uri(object_id.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(body)

  new_options = request_options.merge(
    :operation => :'SearchClient.add_or_update_object',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:PUT, path, new_options)
end

#append_source(source, request_options = {}) ⇒ CreatedAtResponse

Add a source. Add a source to the list of allowed sources.

Parameters:

  • source (Source)

    Source to add. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (CreatedAtResponse)


161
162
163
164
# File 'lib/algolia/api/search_client.rb', line 161

def append_source(source, request_options = {})
  response = append_source_with_http_info(source, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::CreatedAtResponse')
end

#append_source_with_http_info(source, request_options = {}) ⇒ Http::Response

Add a source. Add a source to the list of allowed sources.

Parameters:

  • source (Source)

    Source to add. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/algolia/api/search_client.rb', line 131

def append_source_with_http_info(source, request_options = {})
  # verify the required parameter 'source' is set
  if @api_client.config.client_side_validation && source.nil?
    raise ArgumentError, "Parameter `source` is required when calling `append_source`."
  end

  path = '/1/security/sources/append'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(source)

  new_options = request_options.merge(
    :operation => :'SearchClient.append_source',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#assign_user_id(x_algolia_user_id, assign_user_id_params, request_options = {}) ⇒ CreatedAtResponse

Assign or move a user ID. Assign or move a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID.

Parameters:

  • x_algolia_user_id (String)

    userID to assign. (required)

  • assign_user_id_params (AssignUserIdParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (CreatedAtResponse)


214
215
216
217
# File 'lib/algolia/api/search_client.rb', line 214

def assign_user_id(x_algolia_user_id, assign_user_id_params, request_options = {})
  response = assign_user_id_with_http_info(x_algolia_user_id, assign_user_id_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::CreatedAtResponse')
end

#assign_user_id_with_http_info(x_algolia_user_id, assign_user_id_params, request_options = {}) ⇒ Http::Response

Assign or move a user ID. Assign or move a user ID to a cluster. The time it takes to move a user is proportional to the amount of data linked to the user ID.

Parameters:

  • x_algolia_user_id (String)

    userID to assign. (required)

  • assign_user_id_params (AssignUserIdParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/algolia/api/search_client.rb', line 172

def assign_user_id_with_http_info(x_algolia_user_id, assign_user_id_params, request_options = {})
  # verify the required parameter 'x_algolia_user_id' is set
  if @api_client.config.client_side_validation && x_algolia_user_id.nil?
    raise ArgumentError, "Parameter `x_algolia_user_id` is required when calling `assign_user_id`."
  end

  pattern = /^[a-zA-Z0-9 \-*.]+$/
  if @api_client.config.client_side_validation && x_algolia_user_id !~ pattern
    raise ArgumentError, "invalid value for 'x_algolia_user_id' when calling SearchClient.assign_user_id, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'assign_user_id_params' is set
  if @api_client.config.client_side_validation && assign_user_id_params.nil?
    raise ArgumentError, "Parameter `assign_user_id_params` is required when calling `assign_user_id`."
  end

  path = '/1/clusters/mapping'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params[:'X-Algolia-User-ID'] = x_algolia_user_id
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(assign_user_id_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.assign_user_id',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#batch(index_name, batch_write_params, request_options = {}) ⇒ BatchResponse

Batch write operations on one index. To reduce the time spent on network round trips, you can perform several write actions in a single API call. Actions are applied in the order they are specified. The supported ‘action`s are equivalent to the individual operations of the same name.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • batch_write_params (BatchWriteParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (BatchResponse)


260
261
262
263
# File 'lib/algolia/api/search_client.rb', line 260

def batch(index_name, batch_write_params, request_options = {})
  response = batch_with_http_info(index_name, batch_write_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::BatchResponse')
end

#batch_assign_user_ids(x_algolia_user_id, batch_assign_user_ids_params, request_options = {}) ⇒ CreatedAtResponse

Batch assign userIDs. Assign multiple user IDs to a cluster. **You can’t move users with this operation.**.

Parameters:

  • x_algolia_user_id (String)

    userID to assign. (required)

  • batch_assign_user_ids_params (BatchAssignUserIdsParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (CreatedAtResponse)


313
314
315
316
# File 'lib/algolia/api/search_client.rb', line 313

def batch_assign_user_ids(x_algolia_user_id, batch_assign_user_ids_params, request_options = {})
  response = batch_assign_user_ids_with_http_info(x_algolia_user_id, batch_assign_user_ids_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::CreatedAtResponse')
end

#batch_assign_user_ids_with_http_info(x_algolia_user_id, batch_assign_user_ids_params, request_options = {}) ⇒ Http::Response

Batch assign userIDs. Assign multiple user IDs to a cluster. **You can&#39;t move users with this operation.**.

Parameters:

  • x_algolia_user_id (String)

    userID to assign. (required)

  • batch_assign_user_ids_params (BatchAssignUserIdsParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/algolia/api/search_client.rb', line 271

def batch_assign_user_ids_with_http_info(x_algolia_user_id, batch_assign_user_ids_params, request_options = {})
  # verify the required parameter 'x_algolia_user_id' is set
  if @api_client.config.client_side_validation && x_algolia_user_id.nil?
    raise ArgumentError, "Parameter `x_algolia_user_id` is required when calling `batch_assign_user_ids`."
  end

  pattern = /^[a-zA-Z0-9 \-*.]+$/
  if @api_client.config.client_side_validation && x_algolia_user_id !~ pattern
    raise ArgumentError, "invalid value for 'x_algolia_user_id' when calling SearchClient.batch_assign_user_ids, must conform to the pattern #{pattern}."
  end

  # verify the required parameter 'batch_assign_user_ids_params' is set
  if @api_client.config.client_side_validation && batch_assign_user_ids_params.nil?
    raise ArgumentError, "Parameter `batch_assign_user_ids_params` is required when calling `batch_assign_user_ids`."
  end

  path = '/1/clusters/mapping/batch'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params[:'X-Algolia-User-ID'] = x_algolia_user_id
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(batch_assign_user_ids_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.batch_assign_user_ids',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#batch_dictionary_entries(dictionary_name, batch_dictionary_entries_params, request_options = {}) ⇒ UpdatedAtResponse

Batch dictionary entries. Add or remove a batch of dictionary entries.

Parameters:

  • dictionary_name (DictionaryType)

    Dictionary to search in. (required)

  • batch_dictionary_entries_params (BatchDictionaryEntriesParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdatedAtResponse)


359
360
361
362
# File 'lib/algolia/api/search_client.rb', line 359

def batch_dictionary_entries(dictionary_name, batch_dictionary_entries_params, request_options = {})
  response = batch_dictionary_entries_with_http_info(dictionary_name, batch_dictionary_entries_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdatedAtResponse')
end

#batch_dictionary_entries_with_http_info(dictionary_name, batch_dictionary_entries_params, request_options = {}) ⇒ Http::Response

Batch dictionary entries. Add or remove a batch of dictionary entries.

Parameters:

  • dictionary_name (DictionaryType)

    Dictionary to search in. (required)

  • batch_dictionary_entries_params (BatchDictionaryEntriesParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
# File 'lib/algolia/api/search_client.rb', line 324

def batch_dictionary_entries_with_http_info(dictionary_name, batch_dictionary_entries_params, request_options = {})
  # verify the required parameter 'dictionary_name' is set
  if @api_client.config.client_side_validation && dictionary_name.nil?
    raise ArgumentError, "Parameter `dictionary_name` is required when calling `batch_dictionary_entries`."
  end
  # verify the required parameter 'batch_dictionary_entries_params' is set
  if @api_client.config.client_side_validation && batch_dictionary_entries_params.nil?
    raise ArgumentError, "Parameter `batch_dictionary_entries_params` is required when calling `batch_dictionary_entries`."
  end

  path = '/1/dictionaries/{dictionaryName}/batch'.sub('{' + 'dictionaryName' + '}', @api_client.encode_uri(dictionary_name.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(batch_dictionary_entries_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.batch_dictionary_entries',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#batch_with_http_info(index_name, batch_write_params, request_options = {}) ⇒ Http::Response

Batch write operations on one index. To reduce the time spent on network round trips, you can perform several write actions in a single API call. Actions are applied in the order they are specified. The supported &#x60;action&#x60;s are equivalent to the individual operations of the same name.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • batch_write_params (BatchWriteParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/algolia/api/search_client.rb', line 225

def batch_with_http_info(index_name, batch_write_params, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `batch`."
  end
  # verify the required parameter 'batch_write_params' is set
  if @api_client.config.client_side_validation && batch_write_params.nil?
    raise ArgumentError, "Parameter `batch_write_params` is required when calling `batch`."
  end

  path = '/1/indexes/{indexName}/batch'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(batch_write_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.batch',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#browse(index_name, browse_params = nil, request_options = {}) ⇒ BrowseResponse

Get all records from an index. Retrieve up to 1,000 records per call. Supports full-text search and filters. For better performance, it doesn’t support: - The ‘distinct` query parameter - Sorting by typos, proximity, words, or geographical distance.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • browse_params (BrowseParams) (defaults to: nil)
  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (BrowseResponse)


401
402
403
404
# File 'lib/algolia/api/search_client.rb', line 401

def browse(index_name, browse_params = nil, request_options = {})
  response = browse_with_http_info(index_name, browse_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::BrowseResponse')
end

#browse_with_http_info(index_name, browse_params = nil, request_options = {}) ⇒ Http::Response

Get all records from an index. Retrieve up to 1,000 records per call. Supports full-text search and filters. For better performance, it doesn&#39;t support: - The &#x60;distinct&#x60; query parameter - Sorting by typos, proximity, words, or geographical distance.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • browse_params (BrowseParams) (defaults to: nil)
  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'lib/algolia/api/search_client.rb', line 370

def browse_with_http_info(index_name, browse_params = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `browse`."
  end

  path = '/1/indexes/{indexName}/browse'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(browse_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.browse',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#clear_all_synonyms(index_name, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse

Delete all synonyms. Delete all synonyms in the index.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdatedAtResponse)


444
445
446
447
# File 'lib/algolia/api/search_client.rb', line 444

def clear_all_synonyms(index_name, forward_to_replicas = nil, request_options = {})
  response = clear_all_synonyms_with_http_info(index_name, forward_to_replicas, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdatedAtResponse')
end

#clear_all_synonyms_with_http_info(index_name, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response

Delete all synonyms. Delete all synonyms in the index.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/algolia/api/search_client.rb', line 412

def clear_all_synonyms_with_http_info(index_name, forward_to_replicas = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `clear_all_synonyms`."
  end

  path = '/1/indexes/{indexName}/synonyms/clear'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.clear_all_synonyms',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#clear_objects(index_name, request_options = {}) ⇒ UpdatedAtResponse

Delete all records from an index. Delete the records but leave settings and index-specific API keys untouched.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdatedAtResponse)


484
485
486
487
# File 'lib/algolia/api/search_client.rb', line 484

def clear_objects(index_name, request_options = {})
  response = clear_objects_with_http_info(index_name, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdatedAtResponse')
end

#clear_objects_with_http_info(index_name, request_options = {}) ⇒ Http::Response

Delete all records from an index. Delete the records but leave settings and index-specific API keys untouched.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/algolia/api/search_client.rb', line 454

def clear_objects_with_http_info(index_name, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `clear_objects`."
  end

  path = '/1/indexes/{indexName}/clear'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.clear_objects',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#clear_rules(index_name, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse

Delete all rules. Delete all rules in the index.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdatedAtResponse)


527
528
529
530
# File 'lib/algolia/api/search_client.rb', line 527

def clear_rules(index_name, forward_to_replicas = nil, request_options = {})
  response = clear_rules_with_http_info(index_name, forward_to_replicas, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdatedAtResponse')
end

#clear_rules_with_http_info(index_name, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response

Delete all rules. Delete all rules in the index.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
# File 'lib/algolia/api/search_client.rb', line 495

def clear_rules_with_http_info(index_name, forward_to_replicas = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `clear_rules`."
  end

  path = '/1/indexes/{indexName}/rules/clear'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.clear_rules',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#custom_delete(path, parameters = nil, request_options = {}) ⇒ Object

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


570
571
572
573
# File 'lib/algolia/api/search_client.rb', line 570

def custom_delete(path, parameters = nil, request_options = {})
  response = custom_delete_with_http_info(path, parameters, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

#custom_delete_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# File 'lib/algolia/api/search_client.rb', line 538

def custom_delete_with_http_info(path, parameters = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_delete`."
  end

  path = '/1{path}'.sub('{' + 'path' + '}', path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.custom_delete',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:DELETE, path, new_options)
end

#custom_get(path, parameters = nil, request_options = {}) ⇒ Object

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


613
614
615
616
# File 'lib/algolia/api/search_client.rb', line 613

def custom_get(path, parameters = nil, request_options = {})
  response = custom_get_with_http_info(path, parameters, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

#custom_get_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
# File 'lib/algolia/api/search_client.rb', line 581

def custom_get_with_http_info(path, parameters = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_get`."
  end

  path = '/1{path}'.sub('{' + 'path' + '}', path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.custom_get',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#custom_post(path, parameters = nil, body = nil, request_options = {}) ⇒ Object

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


658
659
660
661
# File 'lib/algolia/api/search_client.rb', line 658

def custom_post(path, parameters = nil, body = nil, request_options = {})
  response = custom_post_with_http_info(path, parameters, body, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

#custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
# File 'lib/algolia/api/search_client.rb', line 625

def custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_post`."
  end

  path = '/1{path}'.sub('{' + 'path' + '}', path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(body)

  new_options = request_options.merge(
    :operation => :'SearchClient.custom_post',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#custom_put(path, parameters = nil, body = nil, request_options = {}) ⇒ Object

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Object)


703
704
705
706
# File 'lib/algolia/api/search_client.rb', line 703

def custom_put(path, parameters = nil, body = nil, request_options = {})
  response = custom_put_with_http_info(path, parameters, body, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Object')
end

#custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response

Send requests to the Algolia REST API. This method allow you to send requests to the Algolia REST API.

Parameters:

  • path (String)

    Path of the endpoint, anything after &quot;/1&quot; must be specified. (required)

  • parameters (Hash<String, Object>) (defaults to: nil)

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
# File 'lib/algolia/api/search_client.rb', line 670

def custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {})
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    raise ArgumentError, "Parameter `path` is required when calling `custom_put`."
  end

  path = '/1{path}'.sub('{' + 'path' + '}', path.to_s)
  query_params = {}
  query_params = query_params.merge(parameters) unless parameters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(body)

  new_options = request_options.merge(
    :operation => :'SearchClient.custom_put',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:PUT, path, new_options)
end

#delete_api_key(key, request_options = {}) ⇒ DeleteApiKeyResponse

Delete API key. Delete an existing API key. The request must be authenticated with the admin API key.

Parameters:

  • key (String)

    API key. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (DeleteApiKeyResponse)


743
744
745
746
# File 'lib/algolia/api/search_client.rb', line 743

def delete_api_key(key, request_options = {})
  response = delete_api_key_with_http_info(key, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::DeleteApiKeyResponse')
end

#delete_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response

Delete API key. Delete an existing API key. The request must be authenticated with the admin API key.

Parameters:

  • key (String)

    API key. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
# File 'lib/algolia/api/search_client.rb', line 713

def delete_api_key_with_http_info(key, request_options = {})
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    raise ArgumentError, "Parameter `key` is required when calling `delete_api_key`."
  end

  path = '/1/keys/{key}'.sub('{' + 'key' + '}', @api_client.encode_uri(key.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.delete_api_key',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:DELETE, path, new_options)
end

#delete_by(index_name, delete_by_params, request_options = {}) ⇒ DeletedAtResponse

Delete all records matching a query. This operation doesn’t support all the query options, only its filters (numeric, facet, or tag) and geo queries. It doesn’t accept empty filters or queries.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • delete_by_params (DeleteByParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (DeletedAtResponse)


789
790
791
792
# File 'lib/algolia/api/search_client.rb', line 789

def delete_by(index_name, delete_by_params, request_options = {})
  response = delete_by_with_http_info(index_name, delete_by_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::DeletedAtResponse')
end

#delete_by_with_http_info(index_name, delete_by_params, request_options = {}) ⇒ Http::Response

Delete all records matching a query. This operation doesn&#39;t support all the query options, only its filters (numeric, facet, or tag) and geo queries. It doesn&#39;t accept empty filters or queries.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • delete_by_params (DeleteByParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
# File 'lib/algolia/api/search_client.rb', line 754

def delete_by_with_http_info(index_name, delete_by_params, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `delete_by`."
  end
  # verify the required parameter 'delete_by_params' is set
  if @api_client.config.client_side_validation && delete_by_params.nil?
    raise ArgumentError, "Parameter `delete_by_params` is required when calling `delete_by`."
  end

  path = '/1/indexes/{indexName}/deleteByQuery'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(delete_by_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.delete_by',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#delete_index(index_name, request_options = {}) ⇒ DeletedAtResponse

Delete index. Delete an existing index.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (DeletedAtResponse)


829
830
831
832
# File 'lib/algolia/api/search_client.rb', line 829

def delete_index(index_name, request_options = {})
  response = delete_index_with_http_info(index_name, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::DeletedAtResponse')
end

#delete_index_with_http_info(index_name, request_options = {}) ⇒ Http::Response

Delete index. Delete an existing index.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
# File 'lib/algolia/api/search_client.rb', line 799

def delete_index_with_http_info(index_name, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `delete_index`."
  end

  path = '/1/indexes/{indexName}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.delete_index',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:DELETE, path, new_options)
end

#delete_object(index_name, object_id, request_options = {}) ⇒ DeletedAtResponse

Delete a record. To delete a set of records matching a query, use the [‘deleteByQuery` operation](#tag/Records/operation/deleteBy) instead.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique record (object) identifier. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (DeletedAtResponse)


876
877
878
879
# File 'lib/algolia/api/search_client.rb', line 876

def delete_object(index_name, object_id, request_options = {})
  response = delete_object_with_http_info(index_name, object_id, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::DeletedAtResponse')
end

#delete_object_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response

Delete a record. To delete a set of records matching a query, use the [&#x60;deleteByQuery&#x60; operation](#tag/Records/operation/deleteBy) instead.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique record (object) identifier. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
# File 'lib/algolia/api/search_client.rb', line 840

def delete_object_with_http_info(index_name, object_id, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `delete_object`."
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    raise ArgumentError, "Parameter `object_id` is required when calling `delete_object`."
  end

  path = '/1/indexes/{indexName}/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}',
                                                                                                                       @api_client.encode_uri(object_id.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.delete_object',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:DELETE, path, new_options)
end

#delete_rule(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse

Delete a rule. Delete a rule by its ‘objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique identifier of a rule object. (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdatedAtResponse)


926
927
928
929
# File 'lib/algolia/api/search_client.rb', line 926

def delete_rule(index_name, object_id, forward_to_replicas = nil, request_options = {})
  response = delete_rule_with_http_info(index_name, object_id, forward_to_replicas, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdatedAtResponse')
end

#delete_rule_with_http_info(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response

Delete a rule. Delete a rule by its &#x60;objectID&#x60;. To find the &#x60;objectID&#x60; for rules, use the [&#x60;search&#x60; operation](#tag/Rules/operation/searchRules).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique identifier of a rule object. (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
# File 'lib/algolia/api/search_client.rb', line 888

def delete_rule_with_http_info(index_name, object_id, forward_to_replicas = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `delete_rule`."
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    raise ArgumentError, "Parameter `object_id` is required when calling `delete_rule`."
  end

  path = '/1/indexes/{indexName}/rules/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}',
                                                                                                                             @api_client.encode_uri(object_id.to_s))
  query_params = {}
  query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.delete_rule',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:DELETE, path, new_options)
end

#delete_source(source, request_options = {}) ⇒ DeleteSourceResponse

Remove a source. Remove a source from the list of allowed sources.

Parameters:

  • source (String)

    IP address range of the source. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (DeleteSourceResponse)


966
967
968
969
# File 'lib/algolia/api/search_client.rb', line 966

def delete_source(source, request_options = {})
  response = delete_source_with_http_info(source, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::DeleteSourceResponse')
end

#delete_source_with_http_info(source, request_options = {}) ⇒ Http::Response

Remove a source. Remove a source from the list of allowed sources.

Parameters:

  • source (String)

    IP address range of the source. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
# File 'lib/algolia/api/search_client.rb', line 936

def delete_source_with_http_info(source, request_options = {})
  # verify the required parameter 'source' is set
  if @api_client.config.client_side_validation && source.nil?
    raise ArgumentError, "Parameter `source` is required when calling `delete_source`."
  end

  path = '/1/security/sources/{source}'.sub('{' + 'source' + '}', @api_client.encode_uri(source.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.delete_source',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:DELETE, path, new_options)
end

#delete_synonym(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ DeletedAtResponse

Delete a synonym. Delete a synonym by its ‘objectID`. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique identifier of a synonym object. (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (DeletedAtResponse)


1016
1017
1018
1019
# File 'lib/algolia/api/search_client.rb', line 1016

def delete_synonym(index_name, object_id, forward_to_replicas = nil, request_options = {})
  response = delete_synonym_with_http_info(index_name, object_id, forward_to_replicas, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::DeletedAtResponse')
end

#delete_synonym_with_http_info(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response

Delete a synonym. Delete a synonym by its &#x60;objectID&#x60;. To find the object IDs of your synonyms, use the [&#x60;search&#x60; operation](#tag/Synonyms/operation/searchSynonyms).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique identifier of a synonym object. (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
# File 'lib/algolia/api/search_client.rb', line 978

def delete_synonym_with_http_info(index_name, object_id, forward_to_replicas = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `delete_synonym`."
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    raise ArgumentError, "Parameter `object_id` is required when calling `delete_synonym`."
  end

  path = '/1/indexes/{indexName}/synonyms/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}',
                                                                                                                                @api_client.encode_uri(object_id.to_s))
  query_params = {}
  query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.delete_synonym',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:DELETE, path, new_options)
end

#get_api_key(key, request_options = {}) ⇒ GetApiKeyResponse

Get API key permissions. Get the permissions and restrictions of a specific API key. When authenticating with the admin API key, you can request information for any of your application’s keys. When authenticating with other API keys, you can only retrieve information for that key.

Parameters:

  • key (String)

    API key. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetApiKeyResponse)


1056
1057
1058
1059
# File 'lib/algolia/api/search_client.rb', line 1056

def get_api_key(key, request_options = {})
  response = get_api_key_with_http_info(key, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::GetApiKeyResponse')
end

#get_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response

Get API key permissions. Get the permissions and restrictions of a specific API key. When authenticating with the admin API key, you can request information for any of your application&#39;s keys. When authenticating with other API keys, you can only retrieve information for that key.

Parameters:

  • key (String)

    API key. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
# File 'lib/algolia/api/search_client.rb', line 1026

def get_api_key_with_http_info(key, request_options = {})
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    raise ArgumentError, "Parameter `key` is required when calling `get_api_key`."
  end

  path = '/1/keys/{key}'.sub('{' + 'key' + '}', @api_client.encode_uri(key.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.get_api_key',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_dictionary_languages(request_options = {}) ⇒ Hash<String, Languages>

Parameters:

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Hash<String, Languages>)


1089
1090
1091
1092
# File 'lib/algolia/api/search_client.rb', line 1089

def get_dictionary_languages(request_options = {})
  response = get_dictionary_languages_with_http_info(request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::Hash<String, Languages>')
end

#get_dictionary_languages_with_http_info(request_options = {}) ⇒ Http::Response

Parameters:

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
# File 'lib/algolia/api/search_client.rb', line 1065

def get_dictionary_languages_with_http_info(request_options = {})
  path = '/1/dictionaries/*/languages'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.get_dictionary_languages',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_dictionary_settings(request_options = {}) ⇒ GetDictionarySettingsResponse

Get stop word settings. Get the languages for which [stop words are turned off](#tag/Dictionaries/operation/setDictionarySettings).

Parameters:

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetDictionarySettingsResponse)


1122
1123
1124
1125
# File 'lib/algolia/api/search_client.rb', line 1122

def get_dictionary_settings(request_options = {})
  response = get_dictionary_settings_with_http_info(request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::GetDictionarySettingsResponse')
end

#get_dictionary_settings_with_http_info(request_options = {}) ⇒ Http::Response

Get stop word settings. Get the languages for which [stop words are turned off](#tag/Dictionaries/operation/setDictionarySettings).

Parameters:

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
# File 'lib/algolia/api/search_client.rb', line 1098

def get_dictionary_settings_with_http_info(request_options = {})
  path = '/1/dictionaries/*/settings'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.get_dictionary_settings',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_logs(offset = nil, length = nil, index_name = nil, type = nil, request_options = {}) ⇒ GetLogsResponse

Return the latest log entries. The request must be authenticated by an API key with the [‘logs` ACL](www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). Logs are held for the last seven days. There’s also a logging limit of 1,000 API calls per server. This request counts towards your [operations quota](support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-) but doesn’t appear in the logs itself. > Note: To fetch the logs for a Distributed Search Network (DSN) cluster, target the [DSN’s endpoint](www.algolia.com/doc/guides/scaling/distributed-search-network-dsn/#accessing-dsn-servers).

Parameters:

  • offset (Integer) (defaults to: nil)

    First log entry to retrieve. Sorted by decreasing date with 0 being the most recent. (default to 0)

  • length (Integer) (defaults to: nil)

    Maximum number of entries to retrieve. (default to 10)

  • index_name (String) (defaults to: nil)

    Index for which log entries should be retrieved. When omitted, log entries are retrieved for all indices.

  • type (LogType) (defaults to: nil)

    Type of log entries to retrieve. When omitted, all log entries are retrieved. (default to ‘all’)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetLogsResponse)


1171
1172
1173
1174
# File 'lib/algolia/api/search_client.rb', line 1171

def get_logs(offset = nil, length = nil, index_name = nil, type = nil, request_options = {})
  response = get_logs_with_http_info(offset, length, index_name, type, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::GetLogsResponse')
end

#get_logs_with_http_info(offset = nil, length = nil, index_name = nil, type = nil, request_options = {}) ⇒ Http::Response

Return the latest log entries. The request must be authenticated by an API key with the [&#x60;logs&#x60; ACL](www.algolia.com/doc/guides/security/api-keys/#access-control-list-acl). Logs are held for the last seven days. There&#39;s also a logging limit of 1,000 API calls per server. This request counts towards your [operations quota](support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-) but doesn&#39;t appear in the logs itself. &gt; Note: To fetch the logs for a Distributed Search Network (DSN) cluster, target the [DSN&#39;s endpoint](www.algolia.com/doc/guides/scaling/distributed-search-network-dsn/#accessing-dsn-servers).

Parameters:

  • offset (Integer) (defaults to: nil)

    First log entry to retrieve. Sorted by decreasing date with 0 being the most recent. (default to 0)

  • length (Integer) (defaults to: nil)

    Maximum number of entries to retrieve. (default to 10)

  • index_name (String) (defaults to: nil)

    Index for which log entries should be retrieved. When omitted, log entries are retrieved for all indices.

  • type (LogType) (defaults to: nil)

    Type of log entries to retrieve. When omitted, all log entries are retrieved. (default to ‘all’)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
# File 'lib/algolia/api/search_client.rb', line 1135

def get_logs_with_http_info(offset = nil, length = nil, index_name = nil, type = nil, request_options = {})
  if @api_client.config.client_side_validation && !length.nil? && length > 1000
    raise ArgumentError, 'invalid value for ""length"" when calling SearchClient.get_logs, must be smaller than or equal to 1000.'
  end

  path = '/1/logs'
  query_params = {}
  query_params[:offset] = offset unless offset.nil?
  query_params[:length] = length unless length.nil?
  query_params[:indexName] = index_name unless index_name.nil?
  query_params[:type] = type unless type.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.get_logs',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_object(index_name, object_id, attributes_to_retrieve = nil, request_options = {}) ⇒ Hash<String, String>

Get a record. To get more than one record, use the [‘objects` operation](#tag/Records/operation/getObjects).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique record (object) identifier. (required)

  • attributes_to_retrieve (Array<String>) (defaults to: nil)

    Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. &#x60;objectID&#x60; is always retrieved, even when not specified. [&#x60;unretrievableAttributes&#x60;](www.algolia.com/doc/api-reference/api-parameters/unretrievableAttributes/) won&#39;t be retrieved unless the request is authenticated with the admin API key.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Hash<String, String>)


1221
1222
1223
1224
# File 'lib/algolia/api/search_client.rb', line 1221

def get_object(index_name, object_id, attributes_to_retrieve = nil, request_options = {})
  response = get_object_with_http_info(index_name, object_id, attributes_to_retrieve, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::Hash<String, String>')
end

#get_object_with_http_info(index_name, object_id, attributes_to_retrieve = nil, request_options = {}) ⇒ Http::Response

Get a record. To get more than one record, use the [&#x60;objects&#x60; operation](#tag/Records/operation/getObjects).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique record (object) identifier. (required)

  • attributes_to_retrieve (Array<String>) (defaults to: nil)

    Attributes to include with the records in the response. This is useful to reduce the size of the API response. By default, all retrievable attributes are returned. &#x60;objectID&#x60; is always retrieved, even when not specified. [&#x60;unretrievableAttributes&#x60;](www.algolia.com/doc/api-reference/api-parameters/unretrievableAttributes/) won&#39;t be retrieved unless the request is authenticated with the admin API key.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
# File 'lib/algolia/api/search_client.rb', line 1183

def get_object_with_http_info(index_name, object_id, attributes_to_retrieve = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `get_object`."
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    raise ArgumentError, "Parameter `object_id` is required when calling `get_object`."
  end

  path = '/1/indexes/{indexName}/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}',
                                                                                                                       @api_client.encode_uri(object_id.to_s))
  query_params = {}
  query_params[:attributesToRetrieve] = @api_client.build_collection_param(attributes_to_retrieve, :multi) unless attributes_to_retrieve.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.get_object',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_objects(get_objects_params, request_options = {}) ⇒ GetObjectsResponse

Get multiple records. Retrieve one or more records, potentially from different indices, in a single API operation. Results will be received in the same order as the requests.

Parameters:

  • get_objects_params (GetObjectsParams)

    Request object. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetObjectsResponse)


1261
1262
1263
1264
# File 'lib/algolia/api/search_client.rb', line 1261

def get_objects(get_objects_params, request_options = {})
  response = get_objects_with_http_info(get_objects_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::GetObjectsResponse')
end

#get_objects_with_http_info(get_objects_params, request_options = {}) ⇒ Http::Response

Get multiple records. Retrieve one or more records, potentially from different indices, in a single API operation. Results will be received in the same order as the requests.

Parameters:

  • get_objects_params (GetObjectsParams)

    Request object. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
# File 'lib/algolia/api/search_client.rb', line 1231

def get_objects_with_http_info(get_objects_params, request_options = {})
  # verify the required parameter 'get_objects_params' is set
  if @api_client.config.client_side_validation && get_objects_params.nil?
    raise ArgumentError, "Parameter `get_objects_params` is required when calling `get_objects`."
  end

  path = '/1/indexes/*/objects'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(get_objects_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.get_objects',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#get_rule(index_name, object_id, request_options = {}) ⇒ Rule

Get a rule. Get a rule by its ‘objectID`. To find the `objectID` for rules, use the [`search` operation](#tag/Rules/operation/searchRules).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique identifier of a rule object. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Rule)


1308
1309
1310
1311
# File 'lib/algolia/api/search_client.rb', line 1308

def get_rule(index_name, object_id, request_options = {})
  response = get_rule_with_http_info(index_name, object_id, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::Rule')
end

#get_rule_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response

Get a rule. Get a rule by its &#x60;objectID&#x60;. To find the &#x60;objectID&#x60; for rules, use the [&#x60;search&#x60; operation](#tag/Rules/operation/searchRules).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique identifier of a rule object. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
# File 'lib/algolia/api/search_client.rb', line 1272

def get_rule_with_http_info(index_name, object_id, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `get_rule`."
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    raise ArgumentError, "Parameter `object_id` is required when calling `get_rule`."
  end

  path = '/1/indexes/{indexName}/rules/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}',
                                                                                                                             @api_client.encode_uri(object_id.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.get_rule',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_settings(index_name, request_options = {}) ⇒ IndexSettings

Get index settings. Return an object containing an index’s [configuration settings](www.algolia.com/doc/api-reference/settings-api-parameters/).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (IndexSettings)


1348
1349
1350
1351
# File 'lib/algolia/api/search_client.rb', line 1348

def get_settings(index_name, request_options = {})
  response = get_settings_with_http_info(index_name, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::IndexSettings')
end

#get_settings_with_http_info(index_name, request_options = {}) ⇒ Http::Response

Get index settings. Return an object containing an index&#39;s [configuration settings](www.algolia.com/doc/api-reference/settings-api-parameters/).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
# File 'lib/algolia/api/search_client.rb', line 1318

def get_settings_with_http_info(index_name, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `get_settings`."
  end

  path = '/1/indexes/{indexName}/settings'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.get_settings',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_sources(request_options = {}) ⇒ Array<Source>

Get all allowed IP addresses. Get all allowed sources (IP addresses).

Parameters:

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (Array<Source>)


1381
1382
1383
1384
# File 'lib/algolia/api/search_client.rb', line 1381

def get_sources(request_options = {})
  response = get_sources_with_http_info(request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Array<Search::Source>')
end

#get_sources_with_http_info(request_options = {}) ⇒ Http::Response

Get all allowed IP addresses. Get all allowed sources (IP addresses).

Parameters:

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
# File 'lib/algolia/api/search_client.rb', line 1357

def get_sources_with_http_info(request_options = {})
  path = '/1/security/sources'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.get_sources',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_synonym(index_name, object_id, request_options = {}) ⇒ SynonymHit

Get a synonym object. Get a syonym by its ‘objectID`. To find the object IDs for your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique identifier of a synonym object. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (SynonymHit)


1428
1429
1430
1431
# File 'lib/algolia/api/search_client.rb', line 1428

def get_synonym(index_name, object_id, request_options = {})
  response = get_synonym_with_http_info(index_name, object_id, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::SynonymHit')
end

#get_synonym_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response

Get a synonym object. Get a syonym by its &#x60;objectID&#x60;. To find the object IDs for your synonyms, use the [&#x60;search&#x60; operation](#tag/Synonyms/operation/searchSynonyms).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique identifier of a synonym object. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
# File 'lib/algolia/api/search_client.rb', line 1392

def get_synonym_with_http_info(index_name, object_id, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `get_synonym`."
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    raise ArgumentError, "Parameter `object_id` is required when calling `get_synonym`."
  end

  path = '/1/indexes/{indexName}/synonyms/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}',
                                                                                                                                @api_client.encode_uri(object_id.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.get_synonym',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_task(index_name, task_id, request_options = {}) ⇒ GetTaskResponse

Check a task’s status. Some operations, such as copying an index, will respond with a ‘taskID` value. Use this value here to check the status of that task.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • task_id (Integer)

    Unique task identifier. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetTaskResponse)


1475
1476
1477
1478
# File 'lib/algolia/api/search_client.rb', line 1475

def get_task(index_name, task_id, request_options = {})
  response = get_task_with_http_info(index_name, task_id, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::GetTaskResponse')
end

#get_task_with_http_info(index_name, task_id, request_options = {}) ⇒ Http::Response

Check a task&#39;s status. Some operations, such as copying an index, will respond with a &#x60;taskID&#x60; value. Use this value here to check the status of that task.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • task_id (Integer)

    Unique task identifier. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
# File 'lib/algolia/api/search_client.rb', line 1439

def get_task_with_http_info(index_name, task_id, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `get_task`."
  end
  # verify the required parameter 'task_id' is set
  if @api_client.config.client_side_validation && task_id.nil?
    raise ArgumentError, "Parameter `task_id` is required when calling `get_task`."
  end

  path = '/1/indexes/{indexName}/task/{taskID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'taskID' + '}',
                                                                                                                          @api_client.encode_uri(task_id.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.get_task',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_top_user_ids(request_options = {}) ⇒ GetTopUserIdsResponse

Get top userID. Get the IDs of the 10 users with the highest number of records per cluster. Since it can take up to a few seconds to get the data from the different clusters, the response isn’t real-time.

Parameters:

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (GetTopUserIdsResponse)


1508
1509
1510
1511
# File 'lib/algolia/api/search_client.rb', line 1508

def get_top_user_ids(request_options = {})
  response = get_top_user_ids_with_http_info(request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::GetTopUserIdsResponse')
end

#get_top_user_ids_with_http_info(request_options = {}) ⇒ Http::Response

Get top userID. Get the IDs of the 10 users with the highest number of records per cluster. Since it can take up to a few seconds to get the data from the different clusters, the response isn&#39;t real-time.

Parameters:

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
# File 'lib/algolia/api/search_client.rb', line 1484

def get_top_user_ids_with_http_info(request_options = {})
  path = '/1/clusters/mapping/top'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.get_top_user_ids',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#get_user_id(user_id, request_options = {}) ⇒ UserId

Get userID. Returns the userID data stored in the mapping. Since it can take up to a few seconds to get the data from the different clusters, the response isn’t real-time.

Parameters:

  • user_id (String)

    userID to assign. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UserId)


1553
1554
1555
1556
# File 'lib/algolia/api/search_client.rb', line 1553

def get_user_id(user_id, request_options = {})
  response = get_user_id_with_http_info(user_id, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UserId')
end

#get_user_id_with_http_info(user_id, request_options = {}) ⇒ Http::Response

Get userID. Returns the userID data stored in the mapping. Since it can take up to a few seconds to get the data from the different clusters, the response isn&#39;t real-time.

Parameters:

  • user_id (String)

    userID to assign. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
# File 'lib/algolia/api/search_client.rb', line 1518

def get_user_id_with_http_info(user_id, request_options = {})
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    raise ArgumentError, "Parameter `user_id` is required when calling `get_user_id`."
  end

  pattern = /^[a-zA-Z0-9 \-*.]+$/
  if @api_client.config.client_side_validation && user_id !~ pattern
    raise ArgumentError, "invalid value for 'user_id' when calling SearchClient.get_user_id, must conform to the pattern #{pattern}."
  end

  path = '/1/clusters/mapping/{userID}'.sub('{' + 'userID' + '}', @api_client.encode_uri(user_id.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.get_user_id',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#has_pending_mappings(get_clusters = nil, request_options = {}) ⇒ HasPendingMappingsResponse

Get migration and user mapping status. To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process.

Parameters:

  • get_clusters (Boolean) (defaults to: nil)

    Indicates whether to include the cluster&#39;s pending mapping state in the response.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (HasPendingMappingsResponse)


1589
1590
1591
1592
# File 'lib/algolia/api/search_client.rb', line 1589

def has_pending_mappings(get_clusters = nil, request_options = {})
  response = has_pending_mappings_with_http_info(get_clusters, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::HasPendingMappingsResponse')
end

#has_pending_mappings_with_http_info(get_clusters = nil, request_options = {}) ⇒ Http::Response

Get migration and user mapping status. To determine when the time-consuming process of creating a large batch of users or migrating users from one cluster to another is complete, this operation retrieves the status of the process.

Parameters:

  • get_clusters (Boolean) (defaults to: nil)

    Indicates whether to include the cluster&#39;s pending mapping state in the response.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
# File 'lib/algolia/api/search_client.rb', line 1563

def has_pending_mappings_with_http_info(get_clusters = nil, request_options = {})
  path = '/1/clusters/mapping/pending'
  query_params = {}
  query_params[:getClusters] = get_clusters unless get_clusters.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.has_pending_mappings',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#list_api_keys(request_options = {}) ⇒ ListApiKeysResponse

List API keys. List all API keys associated with your Algolia application, including their permissions and restrictions.

Parameters:

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (ListApiKeysResponse)


1622
1623
1624
1625
# File 'lib/algolia/api/search_client.rb', line 1622

def list_api_keys(request_options = {})
  response = list_api_keys_with_http_info(request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::ListApiKeysResponse')
end

#list_api_keys_with_http_info(request_options = {}) ⇒ Http::Response

List API keys. List all API keys associated with your Algolia application, including their permissions and restrictions.

Parameters:

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
# File 'lib/algolia/api/search_client.rb', line 1598

def list_api_keys_with_http_info(request_options = {})
  path = '/1/keys'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.list_api_keys',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#list_clusters(request_options = {}) ⇒ ListClustersResponse

List clusters. List the available clusters in a multi-cluster setup.

Parameters:

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (ListClustersResponse)


1655
1656
1657
1658
# File 'lib/algolia/api/search_client.rb', line 1655

def list_clusters(request_options = {})
  response = list_clusters_with_http_info(request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::ListClustersResponse')
end

#list_clusters_with_http_info(request_options = {}) ⇒ Http::Response

List clusters. List the available clusters in a multi-cluster setup.

Parameters:

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
# File 'lib/algolia/api/search_client.rb', line 1631

def list_clusters_with_http_info(request_options = {})
  path = '/1/clusters'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.list_clusters',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#list_indices(page = nil, hits_per_page = nil, request_options = {}) ⇒ ListIndicesResponse

List indices. List indices in an Algolia application.

Parameters:

  • page (Integer) (defaults to: nil)

    Returns the requested page number. The page size is determined by the &#x60;hitsPerPage&#x60; parameter. You can see the number of available pages in the &#x60;nbPages&#x60; response attribute. When &#x60;page&#x60; is null, the API response is not paginated.

  • hits_per_page (Integer) (defaults to: nil)

    Maximum number of hits per page. (default to 100)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (ListIndicesResponse)


1698
1699
1700
1701
# File 'lib/algolia/api/search_client.rb', line 1698

def list_indices(page = nil, hits_per_page = nil, request_options = {})
  response = list_indices_with_http_info(page, hits_per_page, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::ListIndicesResponse')
end

#list_indices_with_http_info(page = nil, hits_per_page = nil, request_options = {}) ⇒ Http::Response

List indices. List indices in an Algolia application.

Parameters:

  • page (Integer) (defaults to: nil)

    Returns the requested page number. The page size is determined by the &#x60;hitsPerPage&#x60; parameter. You can see the number of available pages in the &#x60;nbPages&#x60; response attribute. When &#x60;page&#x60; is null, the API response is not paginated.

  • hits_per_page (Integer) (defaults to: nil)

    Maximum number of hits per page. (default to 100)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
# File 'lib/algolia/api/search_client.rb', line 1666

def list_indices_with_http_info(page = nil, hits_per_page = nil, request_options = {})
  if @api_client.config.client_side_validation && !page.nil? && page < 0
    raise ArgumentError, 'invalid value for ""page"" when calling SearchClient.list_indices, must be greater than or equal to 0.'
  end

  path = '/1/indexes'
  query_params = {}
  query_params[:page] = page unless page.nil?
  query_params[:hitsPerPage] = hits_per_page unless hits_per_page.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.list_indices',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#list_user_ids(page = nil, hits_per_page = nil, request_options = {}) ⇒ ListUserIdsResponse

List userIDs. List the userIDs assigned to a multi-cluster application. Since it can take up to a few seconds to get the data from the different clusters, the response isn’t real-time.

Parameters:

  • page (Integer) (defaults to: nil)

    Returns the requested page number. The page size is determined by the &#x60;hitsPerPage&#x60; parameter. You can see the number of available pages in the &#x60;nbPages&#x60; response attribute. When &#x60;page&#x60; is null, the API response is not paginated.

  • hits_per_page (Integer) (defaults to: nil)

    Maximum number of hits per page. (default to 100)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (ListUserIdsResponse)


1741
1742
1743
1744
# File 'lib/algolia/api/search_client.rb', line 1741

def list_user_ids(page = nil, hits_per_page = nil, request_options = {})
  response = list_user_ids_with_http_info(page, hits_per_page, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::ListUserIdsResponse')
end

#list_user_ids_with_http_info(page = nil, hits_per_page = nil, request_options = {}) ⇒ Http::Response

List userIDs. List the userIDs assigned to a multi-cluster application. Since it can take up to a few seconds to get the data from the different clusters, the response isn&#39;t real-time.

Parameters:

  • page (Integer) (defaults to: nil)

    Returns the requested page number. The page size is determined by the &#x60;hitsPerPage&#x60; parameter. You can see the number of available pages in the &#x60;nbPages&#x60; response attribute. When &#x60;page&#x60; is null, the API response is not paginated.

  • hits_per_page (Integer) (defaults to: nil)

    Maximum number of hits per page. (default to 100)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
# File 'lib/algolia/api/search_client.rb', line 1709

def list_user_ids_with_http_info(page = nil, hits_per_page = nil, request_options = {})
  if @api_client.config.client_side_validation && !page.nil? && page < 0
    raise ArgumentError, 'invalid value for ""page"" when calling SearchClient.list_user_ids, must be greater than or equal to 0.'
  end

  path = '/1/clusters/mapping'
  query_params = {}
  query_params[:page] = page unless page.nil?
  query_params[:hitsPerPage] = hits_per_page unless hits_per_page.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.list_user_ids',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:GET, path, new_options)
end

#multiple_batch(batch_params, request_options = {}) ⇒ MultipleBatchResponse

Batch write operations on multiple indices. To reduce the time spent on network round trips, you can perform several write actions in a single request. It’s a multi-index version of the [‘batch` operation](#tag/Records/operation/batch). Actions are applied in the order they are specified. The supported actions are equivalent to the individual operations of the same name.

Parameters:

  • batch_params (BatchParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (MultipleBatchResponse)


1781
1782
1783
1784
# File 'lib/algolia/api/search_client.rb', line 1781

def multiple_batch(batch_params, request_options = {})
  response = multiple_batch_with_http_info(batch_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::MultipleBatchResponse')
end

#multiple_batch_with_http_info(batch_params, request_options = {}) ⇒ Http::Response

Batch write operations on multiple indices. To reduce the time spent on network round trips, you can perform several write actions in a single request. It&#39;s a multi-index version of the [&#x60;batch&#x60; operation](#tag/Records/operation/batch). Actions are applied in the order they are specified. The supported actions are equivalent to the individual operations of the same name.

Parameters:

  • batch_params (BatchParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
# File 'lib/algolia/api/search_client.rb', line 1751

def multiple_batch_with_http_info(batch_params, request_options = {})
  # verify the required parameter 'batch_params' is set
  if @api_client.config.client_side_validation && batch_params.nil?
    raise ArgumentError, "Parameter `batch_params` is required when calling `multiple_batch`."
  end

  path = '/1/indexes/*/batch'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(batch_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.multiple_batch',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#operation_index(index_name, operation_index_params, request_options = {}) ⇒ UpdatedAtResponse

Copy, move, or rename an index. This ‘operation`, copy or move, will copy or move a source index’s (‘IndexName`) records, settings, synonyms, and rules to a `destination` index. If the destination index exists, it will be replaced, except for index-specific API keys and analytics data. If the destination index doesn’t exist, it will be created. The choice between moving or copying an index depends on your needs. Choose: - Move to rename an index. - Copy to create a new index with the same records and configuration as an existing one. > Note: When considering copying or moving, be aware of the [rate limitations](www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits) on these processes and the [impact on your analytics data](www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/concepts/indices-analytics/).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • operation_index_params (OperationIndexParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdatedAtResponse)


1827
1828
1829
1830
# File 'lib/algolia/api/search_client.rb', line 1827

def operation_index(index_name, operation_index_params, request_options = {})
  response = operation_index_with_http_info(index_name, operation_index_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdatedAtResponse')
end

#operation_index_with_http_info(index_name, operation_index_params, request_options = {}) ⇒ Http::Response

Copy, move, or rename an index. This &#x60;operation&#x60;, copy or move, will copy or move a source index&#39;s (&#x60;IndexName&#x60;) records, settings, synonyms, and rules to a &#x60;destination&#x60; index. If the destination index exists, it will be replaced, except for index-specific API keys and analytics data. If the destination index doesn&#39;t exist, it will be created. The choice between moving or copying an index depends on your needs. Choose: - Move to rename an index. - Copy to create a new index with the same records and configuration as an existing one. &gt; Note: When considering copying or moving, be aware of the [rate limitations](www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits) on these processes and the [impact on your analytics data](www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/concepts/indices-analytics/).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • operation_index_params (OperationIndexParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
# File 'lib/algolia/api/search_client.rb', line 1792

def operation_index_with_http_info(index_name, operation_index_params, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `operation_index`."
  end
  # verify the required parameter 'operation_index_params' is set
  if @api_client.config.client_side_validation && operation_index_params.nil?
    raise ArgumentError, "Parameter `operation_index_params` is required when calling `operation_index`."
  end

  path = '/1/indexes/{indexName}/operation'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(operation_index_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.operation_index',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#partial_update_object(index_name, object_id, attributes_to_update, create_if_not_exists = nil, request_options = {}) ⇒ UpdatedAtWithObjectIdResponse

Update record attributes. Add new attributes or update current ones in an existing record. You can use any first-level attribute but not nested attributes. If you specify a [nested attribute](www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/creating-and-using-nested-attributes/), the engine treats it as a replacement for its first-level ancestor.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique record (object) identifier. (required)

  • attributes_to_update (Hash<String, AttributeToUpdate>)

    Object with attributes to update. (required)

  • create_if_not_exists (Boolean) (defaults to: nil)

    Indicates whether to create a new record if it doesn&#39;t exist yet. (default to true)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdatedAtWithObjectIdResponse)


1883
1884
1885
1886
# File 'lib/algolia/api/search_client.rb', line 1883

def partial_update_object(index_name, object_id, attributes_to_update, create_if_not_exists = nil, request_options = {})
  response = partial_update_object_with_http_info(index_name, object_id, attributes_to_update, create_if_not_exists, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdatedAtWithObjectIdResponse')
end

#partial_update_object_with_http_info(index_name, object_id, attributes_to_update, create_if_not_exists = nil, request_options = {}) ⇒ Http::Response

Update record attributes. Add new attributes or update current ones in an existing record. You can use any first-level attribute but not nested attributes. If you specify a [nested attribute](www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/creating-and-using-nested-attributes/), the engine treats it as a replacement for its first-level ancestor.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique record (object) identifier. (required)

  • attributes_to_update (Hash<String, AttributeToUpdate>)

    Object with attributes to update. (required)

  • create_if_not_exists (Boolean) (defaults to: nil)

    Indicates whether to create a new record if it doesn&#39;t exist yet. (default to true)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
# File 'lib/algolia/api/search_client.rb', line 1840

def partial_update_object_with_http_info(index_name, object_id, attributes_to_update, create_if_not_exists = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `partial_update_object`."
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    raise ArgumentError, "Parameter `object_id` is required when calling `partial_update_object`."
  end
  # verify the required parameter 'attributes_to_update' is set
  if @api_client.config.client_side_validation && attributes_to_update.nil?
    raise ArgumentError, "Parameter `attributes_to_update` is required when calling `partial_update_object`."
  end

  path = '/1/indexes/{indexName}/{objectID}/partial'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}',
                                                                                                                               @api_client.encode_uri(object_id.to_s))
  query_params = {}
  query_params[:createIfNotExists] = create_if_not_exists unless create_if_not_exists.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(attributes_to_update)

  new_options = request_options.merge(
    :operation => :'SearchClient.partial_update_object',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#remove_user_id(user_id, request_options = {}) ⇒ RemoveUserIdResponse

Remove userID. Remove a userID and its associated data from the multi-clusters.

Parameters:

  • user_id (String)

    userID to assign. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (RemoveUserIdResponse)


1928
1929
1930
1931
# File 'lib/algolia/api/search_client.rb', line 1928

def remove_user_id(user_id, request_options = {})
  response = remove_user_id_with_http_info(user_id, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::RemoveUserIdResponse')
end

#remove_user_id_with_http_info(user_id, request_options = {}) ⇒ Http::Response

Remove userID. Remove a userID and its associated data from the multi-clusters.

Parameters:

  • user_id (String)

    userID to assign. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
# File 'lib/algolia/api/search_client.rb', line 1893

def remove_user_id_with_http_info(user_id, request_options = {})
  # verify the required parameter 'user_id' is set
  if @api_client.config.client_side_validation && user_id.nil?
    raise ArgumentError, "Parameter `user_id` is required when calling `remove_user_id`."
  end

  pattern = /^[a-zA-Z0-9 \-*.]+$/
  if @api_client.config.client_side_validation && user_id !~ pattern
    raise ArgumentError, "invalid value for 'user_id' when calling SearchClient.remove_user_id, must conform to the pattern #{pattern}."
  end

  path = '/1/clusters/mapping/{userID}'.sub('{' + 'userID' + '}', @api_client.encode_uri(user_id.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.remove_user_id',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:DELETE, path, new_options)
end

#replace_sources(source, request_options = {}) ⇒ ReplaceSourceResponse

Replace all sources. Replace all allowed sources.

Parameters:

  • source (Array<Source>)

    Allowed sources. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (ReplaceSourceResponse)


1968
1969
1970
1971
# File 'lib/algolia/api/search_client.rb', line 1968

def replace_sources(source, request_options = {})
  response = replace_sources_with_http_info(source, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::ReplaceSourceResponse')
end

#replace_sources_with_http_info(source, request_options = {}) ⇒ Http::Response

Replace all sources. Replace all allowed sources.

Parameters:

  • source (Array<Source>)

    Allowed sources. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
# File 'lib/algolia/api/search_client.rb', line 1938

def replace_sources_with_http_info(source, request_options = {})
  # verify the required parameter 'source' is set
  if @api_client.config.client_side_validation && source.nil?
    raise ArgumentError, "Parameter `source` is required when calling `replace_sources`."
  end

  path = '/1/security/sources'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(source)

  new_options = request_options.merge(
    :operation => :'SearchClient.replace_sources',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:PUT, path, new_options)
end

#restore_api_key(key, request_options = {}) ⇒ AddApiKeyResponse

Restore API key. Restore a deleted API key, along with its associated permissions. The request must be authenticated with the admin API key.

Parameters:

  • key (String)

    API key. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (AddApiKeyResponse)


2008
2009
2010
2011
# File 'lib/algolia/api/search_client.rb', line 2008

def restore_api_key(key, request_options = {})
  response = restore_api_key_with_http_info(key, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::AddApiKeyResponse')
end

#restore_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response

Restore API key. Restore a deleted API key, along with its associated permissions. The request must be authenticated with the admin API key.

Parameters:

  • key (String)

    API key. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
# File 'lib/algolia/api/search_client.rb', line 1978

def restore_api_key_with_http_info(key, request_options = {})
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    raise ArgumentError, "Parameter `key` is required when calling `restore_api_key`."
  end

  path = '/1/keys/{key}/restore'.sub('{' + 'key' + '}', @api_client.encode_uri(key.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :'SearchClient.restore_api_key',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#save_object(index_name, body, request_options = {}) ⇒ SaveObjectResponse

Add or update a record. Add a record (object) to an index or replace it. If the record doesn’t contain an ‘objectID`, Algolia automatically adds it. If you use an existing `objectID`, the existing record is replaced with the new one. To add multiple records to your index in a single API request, use the [`batch` operation](#tag/Records/operation/batch).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • body (Object)

    The Algolia record. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (SaveObjectResponse)


2054
2055
2056
2057
# File 'lib/algolia/api/search_client.rb', line 2054

def save_object(index_name, body, request_options = {})
  response = save_object_with_http_info(index_name, body, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::SaveObjectResponse')
end

#save_object_with_http_info(index_name, body, request_options = {}) ⇒ Http::Response

Add or update a record. Add a record (object) to an index or replace it. If the record doesn&#39;t contain an &#x60;objectID&#x60;, Algolia automatically adds it. If you use an existing &#x60;objectID&#x60;, the existing record is replaced with the new one. To add multiple records to your index in a single API request, use the [&#x60;batch&#x60; operation](#tag/Records/operation/batch).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • body (Object)

    The Algolia record. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
# File 'lib/algolia/api/search_client.rb', line 2019

def save_object_with_http_info(index_name, body, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `save_object`."
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    raise ArgumentError, "Parameter `body` is required when calling `save_object`."
  end

  path = '/1/indexes/{indexName}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(body)

  new_options = request_options.merge(
    :operation => :'SearchClient.save_object',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#save_rule(index_name, object_id, rule, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedRuleResponse

Create or update a rule. To create or update more than one rule, use the [‘batch` operation](#tag/Rules/operation/saveRules).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique identifier of a rule object. (required)

  • rule (Rule)

    (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdatedRuleResponse)


2110
2111
2112
2113
# File 'lib/algolia/api/search_client.rb', line 2110

def save_rule(index_name, object_id, rule, forward_to_replicas = nil, request_options = {})
  response = save_rule_with_http_info(index_name, object_id, rule, forward_to_replicas, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdatedRuleResponse')
end

#save_rule_with_http_info(index_name, object_id, rule, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response

Create or update a rule. To create or update more than one rule, use the [&#x60;batch&#x60; operation](#tag/Rules/operation/saveRules).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique identifier of a rule object. (required)

  • rule (Rule)

    (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
# File 'lib/algolia/api/search_client.rb', line 2067

def save_rule_with_http_info(index_name, object_id, rule, forward_to_replicas = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `save_rule`."
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    raise ArgumentError, "Parameter `object_id` is required when calling `save_rule`."
  end
  # verify the required parameter 'rule' is set
  if @api_client.config.client_side_validation && rule.nil?
    raise ArgumentError, "Parameter `rule` is required when calling `save_rule`."
  end

  path = '/1/indexes/{indexName}/rules/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}',
                                                                                                                             @api_client.encode_uri(object_id.to_s))
  query_params = {}
  query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(rule)

  new_options = request_options.merge(
    :operation => :'SearchClient.save_rule',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:PUT, path, new_options)
end

#save_rules(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, request_options = {}) ⇒ UpdatedAtResponse

Save a batch of rules. Create or update multiple rules.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • rules (Array<Rule>)

    (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • clear_existing_rules (Boolean) (defaults to: nil)

    Indicates whether existing rules should be deleted before adding this batch.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdatedAtResponse)


2162
2163
2164
2165
# File 'lib/algolia/api/search_client.rb', line 2162

def save_rules(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, request_options = {})
  response = save_rules_with_http_info(index_name, rules, forward_to_replicas, clear_existing_rules, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdatedAtResponse')
end

#save_rules_with_http_info(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, request_options = {}) ⇒ Http::Response

Save a batch of rules. Create or update multiple rules.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • rules (Array<Rule>)

    (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • clear_existing_rules (Boolean) (defaults to: nil)

    Indicates whether existing rules should be deleted before adding this batch.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
# File 'lib/algolia/api/search_client.rb', line 2123

def save_rules_with_http_info(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `save_rules`."
  end
  # verify the required parameter 'rules' is set
  if @api_client.config.client_side_validation && rules.nil?
    raise ArgumentError, "Parameter `rules` is required when calling `save_rules`."
  end

  path = '/1/indexes/{indexName}/rules/batch'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil?
  query_params[:clearExistingRules] = clear_existing_rules unless clear_existing_rules.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(rules)

  new_options = request_options.merge(
    :operation => :'SearchClient.save_rules',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#save_synonym(index_name, object_id, synonym_hit, forward_to_replicas = nil, request_options = {}) ⇒ SaveSynonymResponse

Save a synonym. Add a [synonym](www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms) to an index or replace it. If the synonym ‘objectID` doesn’t exist, Algolia adds a new one. If you use an existing synonym ‘objectID`, the existing synonym is replaced with the new one. To add multiple synonyms in a single API request, use the [`batch` operation](#tag/Synonyms/operation/saveSynonyms).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique identifier of a synonym object. (required)

  • synonym_hit (SynonymHit)

    (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (SaveSynonymResponse)


2218
2219
2220
2221
# File 'lib/algolia/api/search_client.rb', line 2218

def save_synonym(index_name, object_id, synonym_hit, forward_to_replicas = nil, request_options = {})
  response = save_synonym_with_http_info(index_name, object_id, synonym_hit, forward_to_replicas, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::SaveSynonymResponse')
end

#save_synonym_with_http_info(index_name, object_id, synonym_hit, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response

Save a synonym. Add a [synonym](www.algolia.com/doc/guides/managing-results/optimize-search-results/adding-synonyms/#the-different-types-of-synonyms) to an index or replace it. If the synonym &#x60;objectID&#x60; doesn&#39;t exist, Algolia adds a new one. If you use an existing synonym &#x60;objectID&#x60;, the existing synonym is replaced with the new one. To add multiple synonyms in a single API request, use the [&#x60;batch&#x60; operation](#tag/Synonyms/operation/saveSynonyms).

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • object_id (String)

    Unique identifier of a synonym object. (required)

  • synonym_hit (SynonymHit)

    (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
# File 'lib/algolia/api/search_client.rb', line 2175

def save_synonym_with_http_info(index_name, object_id, synonym_hit, forward_to_replicas = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `save_synonym`."
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    raise ArgumentError, "Parameter `object_id` is required when calling `save_synonym`."
  end
  # verify the required parameter 'synonym_hit' is set
  if @api_client.config.client_side_validation && synonym_hit.nil?
    raise ArgumentError, "Parameter `synonym_hit` is required when calling `save_synonym`."
  end

  path = '/1/indexes/{indexName}/synonyms/{objectID}'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}',
                                                                                                                                @api_client.encode_uri(object_id.to_s))
  query_params = {}
  query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(synonym_hit)

  new_options = request_options.merge(
    :operation => :'SearchClient.save_synonym',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:PUT, path, new_options)
end

#save_synonyms(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, request_options = {}) ⇒ UpdatedAtResponse

Save a batch of synonyms. Create or update multiple synonyms.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • synonym_hit (Array<SynonymHit>)

    (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • replace_existing_synonyms (Boolean) (defaults to: nil)

    Indicates whether to replace all synonyms in the index with the ones sent with this request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdatedAtResponse)


2270
2271
2272
2273
# File 'lib/algolia/api/search_client.rb', line 2270

def save_synonyms(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, request_options = {})
  response = save_synonyms_with_http_info(index_name, synonym_hit, forward_to_replicas, replace_existing_synonyms, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdatedAtResponse')
end

#save_synonyms_with_http_info(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, request_options = {}) ⇒ Http::Response

Save a batch of synonyms. Create or update multiple synonyms.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • synonym_hit (Array<SynonymHit>)

    (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • replace_existing_synonyms (Boolean) (defaults to: nil)

    Indicates whether to replace all synonyms in the index with the ones sent with this request.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
# File 'lib/algolia/api/search_client.rb', line 2231

def save_synonyms_with_http_info(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `save_synonyms`."
  end
  # verify the required parameter 'synonym_hit' is set
  if @api_client.config.client_side_validation && synonym_hit.nil?
    raise ArgumentError, "Parameter `synonym_hit` is required when calling `save_synonyms`."
  end

  path = '/1/indexes/{indexName}/synonyms/batch'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil?
  query_params[:replaceExistingSynonyms] = replace_existing_synonyms unless replace_existing_synonyms.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(synonym_hit)

  new_options = request_options.merge(
    :operation => :'SearchClient.save_synonyms',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#search(search_method_params, request_options = {}) ⇒ SearchResponses

Search multiple indices. Send multiple search queries to one or more indices.

Parameters:

  • search_method_params (SearchMethodParams)

    Query requests and strategies. Results will be received in the same order as the queries. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (SearchResponses)


2310
2311
2312
2313
# File 'lib/algolia/api/search_client.rb', line 2310

def search(search_method_params, request_options = {})
  response = search_with_http_info(search_method_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::SearchResponses')
end

#search_dictionary_entries(dictionary_name, search_dictionary_entries_params, request_options = {}) ⇒ UpdatedAtResponse

Parameters:

  • dictionary_name (DictionaryType)

    Dictionary to search in. (required)

  • search_dictionary_entries_params (SearchDictionaryEntriesParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdatedAtResponse)


2356
2357
2358
2359
# File 'lib/algolia/api/search_client.rb', line 2356

def search_dictionary_entries(dictionary_name, search_dictionary_entries_params, request_options = {})
  response = search_dictionary_entries_with_http_info(dictionary_name, search_dictionary_entries_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdatedAtResponse')
end

#search_dictionary_entries_with_http_info(dictionary_name, search_dictionary_entries_params, request_options = {}) ⇒ Http::Response

Parameters:

  • dictionary_name (DictionaryType)

    Dictionary to search in. (required)

  • search_dictionary_entries_params (SearchDictionaryEntriesParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
# File 'lib/algolia/api/search_client.rb', line 2321

def search_dictionary_entries_with_http_info(dictionary_name, search_dictionary_entries_params, request_options = {})
  # verify the required parameter 'dictionary_name' is set
  if @api_client.config.client_side_validation && dictionary_name.nil?
    raise ArgumentError, "Parameter `dictionary_name` is required when calling `search_dictionary_entries`."
  end
  # verify the required parameter 'search_dictionary_entries_params' is set
  if @api_client.config.client_side_validation && search_dictionary_entries_params.nil?
    raise ArgumentError, "Parameter `search_dictionary_entries_params` is required when calling `search_dictionary_entries`."
  end

  path = '/1/dictionaries/{dictionaryName}/search'.sub('{' + 'dictionaryName' + '}', @api_client.encode_uri(dictionary_name.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(search_dictionary_entries_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.search_dictionary_entries',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#search_for_facet_values(index_name, facet_name, search_for_facet_values_request = nil, request_options = {}) ⇒ SearchForFacetValuesResponse

Search for facet values. [Search for a facet’s values](www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values), optionally restricting the returned values to those contained in records matching other search criteria. > Note: Pagination isn’t supported (‘page` and `hitsPerPage` are ignored). By default, the engine returns a maximum of 10 values but you can adjust this with `maxFacetHits`.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • facet_name (String)

    Facet name. (required)

  • search_for_facet_values_request (SearchForFacetValuesRequest) (defaults to: nil)
  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (SearchForFacetValuesResponse)


2405
2406
2407
2408
# File 'lib/algolia/api/search_client.rb', line 2405

def search_for_facet_values(index_name, facet_name, search_for_facet_values_request = nil, request_options = {})
  response = search_for_facet_values_with_http_info(index_name, facet_name, search_for_facet_values_request, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::SearchForFacetValuesResponse')
end

#search_for_facet_values_with_http_info(index_name, facet_name, search_for_facet_values_request = nil, request_options = {}) ⇒ Http::Response

Search for facet values. [Search for a facet&#39;s values](www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values), optionally restricting the returned values to those contained in records matching other search criteria. &gt; Note: Pagination isn&#39;t supported (&#x60;page&#x60; and &#x60;hitsPerPage&#x60; are ignored). By default, the engine returns a maximum of 10 values but you can adjust this with &#x60;maxFacetHits&#x60;.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • facet_name (String)

    Facet name. (required)

  • search_for_facet_values_request (SearchForFacetValuesRequest) (defaults to: nil)
  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
# File 'lib/algolia/api/search_client.rb', line 2368

def search_for_facet_values_with_http_info(index_name, facet_name, search_for_facet_values_request = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `search_for_facet_values`."
  end
  # verify the required parameter 'facet_name' is set
  if @api_client.config.client_side_validation && facet_name.nil?
    raise ArgumentError, "Parameter `facet_name` is required when calling `search_for_facet_values`."
  end

  path = '/1/indexes/{indexName}/facets/{facetName}/query'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s)).sub('{' + 'facetName' + '}',
                                                                                                                                     @api_client.encode_uri(facet_name.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(search_for_facet_values_request)

  new_options = request_options.merge(
    :operation => :'SearchClient.search_for_facet_values',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#search_rules(index_name, search_rules_params = nil, request_options = {}) ⇒ SearchRulesResponse

Search for rules. Search for rules in your index. You can control the search with parameters. To list all rules, send an empty request body.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • search_rules_params (SearchRulesParams) (defaults to: nil)
  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (SearchRulesResponse)


2447
2448
2449
2450
# File 'lib/algolia/api/search_client.rb', line 2447

def search_rules(index_name, search_rules_params = nil, request_options = {})
  response = search_rules_with_http_info(index_name, search_rules_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::SearchRulesResponse')
end

#search_rules_with_http_info(index_name, search_rules_params = nil, request_options = {}) ⇒ Http::Response

Search for rules. Search for rules in your index. You can control the search with parameters. To list all rules, send an empty request body.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • search_rules_params (SearchRulesParams) (defaults to: nil)
  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
# File 'lib/algolia/api/search_client.rb', line 2416

def search_rules_with_http_info(index_name, search_rules_params = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `search_rules`."
  end

  path = '/1/indexes/{indexName}/rules/search'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(search_rules_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.search_rules',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#search_single_index(index_name, search_params = nil, request_options = {}) ⇒ SearchResponse

Search an index. Return records that match the query.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • search_params (SearchParams) (defaults to: nil)
  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (SearchResponse)


2489
2490
2491
2492
# File 'lib/algolia/api/search_client.rb', line 2489

def search_single_index(index_name, search_params = nil, request_options = {})
  response = search_single_index_with_http_info(index_name, search_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::SearchResponse')
end

#search_single_index_with_http_info(index_name, search_params = nil, request_options = {}) ⇒ Http::Response

Search an index. Return records that match the query.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • search_params (SearchParams) (defaults to: nil)
  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
# File 'lib/algolia/api/search_client.rb', line 2458

def search_single_index_with_http_info(index_name, search_params = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `search_single_index`."
  end

  path = '/1/indexes/{indexName}/query'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(search_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.search_single_index',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#search_synonyms(index_name, type = nil, page = nil, hits_per_page = nil, search_synonyms_params = nil, request_options = {}) ⇒ SearchSynonymsResponse

Search for synonyms. Search for synonyms in your index. You can control and filter the search with parameters. To get all synonyms, send an empty request body.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • type (SynonymType) (defaults to: nil)
  • page (Integer) (defaults to: nil)

    Returns the requested page number (the first page is 0). Page size is set by &#x60;hitsPerPage&#x60;. When null, there&#39;s no pagination. (default to 0)

  • hits_per_page (Integer) (defaults to: nil)

    Maximum number of hits per page. (default to 100)

  • search_synonyms_params (SearchSynonymsParams) (defaults to: nil)

    Body of the &#x60;searchSynonyms&#x60; operation.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (SearchSynonymsResponse)


2543
2544
2545
2546
# File 'lib/algolia/api/search_client.rb', line 2543

def search_synonyms(index_name, type = nil, page = nil, hits_per_page = nil, search_synonyms_params = nil, request_options = {})
  response = search_synonyms_with_http_info(index_name, type, page, hits_per_page, search_synonyms_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::SearchSynonymsResponse')
end

#search_synonyms_with_http_info(index_name, type = nil, page = nil, hits_per_page = nil, search_synonyms_params = nil, request_options = {}) ⇒ Http::Response

Search for synonyms. Search for synonyms in your index. You can control and filter the search with parameters. To get all synonyms, send an empty request body.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • type (SynonymType) (defaults to: nil)
  • page (Integer) (defaults to: nil)

    Returns the requested page number (the first page is 0). Page size is set by &#x60;hitsPerPage&#x60;. When null, there&#39;s no pagination. (default to 0)

  • hits_per_page (Integer) (defaults to: nil)

    Maximum number of hits per page. (default to 100)

  • search_synonyms_params (SearchSynonymsParams) (defaults to: nil)

    Body of the &#x60;searchSynonyms&#x60; operation.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
# File 'lib/algolia/api/search_client.rb', line 2503

def search_synonyms_with_http_info(index_name, type = nil, page = nil, hits_per_page = nil, search_synonyms_params = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `search_synonyms`."
  end
  if @api_client.config.client_side_validation && !page.nil? && page < 0
    raise ArgumentError, 'invalid value for ""page"" when calling SearchClient.search_synonyms, must be greater than or equal to 0.'
  end

  path = '/1/indexes/{indexName}/synonyms/search'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params[:type] = type unless type.nil?
  query_params[:page] = page unless page.nil?
  query_params[:hitsPerPage] = hits_per_page unless hits_per_page.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(search_synonyms_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.search_synonyms',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#search_user_ids(search_user_ids_params, request_options = {}) ⇒ SearchUserIdsResponse

Search for a user ID. Since it can take up to a few seconds to get the data from the different clusters, the response isn’t real-time. To ensure rapid updates, the user IDs index isn’t built at the same time as the mapping. Instead, it’s built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours).

Parameters:

  • search_user_ids_params (SearchUserIdsParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (SearchUserIdsResponse)


2583
2584
2585
2586
# File 'lib/algolia/api/search_client.rb', line 2583

def search_user_ids(search_user_ids_params, request_options = {})
  response = search_user_ids_with_http_info(search_user_ids_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::SearchUserIdsResponse')
end

#search_user_ids_with_http_info(search_user_ids_params, request_options = {}) ⇒ Http::Response

Search for a user ID. Since it can take up to a few seconds to get the data from the different clusters, the response isn&#39;t real-time. To ensure rapid updates, the user IDs index isn&#39;t built at the same time as the mapping. Instead, it&#39;s built every 12 hours, at the same time as the update of user ID usage. For example, if you add or move a user ID, the search will show an old value until the next time the mapping is rebuilt (every 12 hours).

Parameters:

  • search_user_ids_params (SearchUserIdsParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
# File 'lib/algolia/api/search_client.rb', line 2553

def search_user_ids_with_http_info(search_user_ids_params, request_options = {})
  # verify the required parameter 'search_user_ids_params' is set
  if @api_client.config.client_side_validation && search_user_ids_params.nil?
    raise ArgumentError, "Parameter `search_user_ids_params` is required when calling `search_user_ids`."
  end

  path = '/1/clusters/mapping/search'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(search_user_ids_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.search_user_ids',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#search_with_http_info(search_method_params, request_options = {}) ⇒ Http::Response

Search multiple indices. Send multiple search queries to one or more indices.

Parameters:

  • search_method_params (SearchMethodParams)

    Query requests and strategies. Results will be received in the same order as the queries. (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
# File 'lib/algolia/api/search_client.rb', line 2280

def search_with_http_info(search_method_params, request_options = {})
  # verify the required parameter 'search_method_params' is set
  if @api_client.config.client_side_validation && search_method_params.nil?
    raise ArgumentError, "Parameter `search_method_params` is required when calling `search`."
  end

  path = '/1/indexes/*/queries'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(search_method_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.search',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:POST, path, new_options)
end

#set_dictionary_settings(dictionary_settings_params, request_options = {}) ⇒ UpdatedAtResponse

Set stop word settings. Set stop word settings for a specific language.

Parameters:

  • dictionary_settings_params (DictionarySettingsParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdatedAtResponse)


2623
2624
2625
2626
# File 'lib/algolia/api/search_client.rb', line 2623

def set_dictionary_settings(dictionary_settings_params, request_options = {})
  response = set_dictionary_settings_with_http_info(dictionary_settings_params, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdatedAtResponse')
end

#set_dictionary_settings_with_http_info(dictionary_settings_params, request_options = {}) ⇒ Http::Response

Set stop word settings. Set stop word settings for a specific language.

Parameters:

  • dictionary_settings_params (DictionarySettingsParams)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
# File 'lib/algolia/api/search_client.rb', line 2593

def set_dictionary_settings_with_http_info(dictionary_settings_params, request_options = {})
  # verify the required parameter 'dictionary_settings_params' is set
  if @api_client.config.client_side_validation && dictionary_settings_params.nil?
    raise ArgumentError, "Parameter `dictionary_settings_params` is required when calling `set_dictionary_settings`."
  end

  path = '/1/dictionaries/*/settings'
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(dictionary_settings_params)

  new_options = request_options.merge(
    :operation => :'SearchClient.set_dictionary_settings',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:PUT, path, new_options)
end

#set_settings(index_name, index_settings, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse

Update index settings. Update the specified [index settings](www.algolia.com/doc/api-reference/settings-api-parameters/). Specifying null for a setting resets it to its default value.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • index_settings (IndexSettings)

    (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdatedAtResponse)


2672
2673
2674
2675
# File 'lib/algolia/api/search_client.rb', line 2672

def set_settings(index_name, index_settings, forward_to_replicas = nil, request_options = {})
  response = set_settings_with_http_info(index_name, index_settings, forward_to_replicas, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdatedAtResponse')
end

#set_settings_with_http_info(index_name, index_settings, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response

Update index settings. Update the specified [index settings](www.algolia.com/doc/api-reference/settings-api-parameters/). Specifying null for a setting resets it to its default value.

Parameters:

  • index_name (String)

    Index on which to perform the request. (required)

  • index_settings (IndexSettings)

    (required)

  • forward_to_replicas (Boolean) (defaults to: nil)

    Indicates whether changed index settings are forwarded to the replica indices.

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
# File 'lib/algolia/api/search_client.rb', line 2635

def set_settings_with_http_info(index_name, index_settings, forward_to_replicas = nil, request_options = {})
  # verify the required parameter 'index_name' is set
  if @api_client.config.client_side_validation && index_name.nil?
    raise ArgumentError, "Parameter `index_name` is required when calling `set_settings`."
  end
  # verify the required parameter 'index_settings' is set
  if @api_client.config.client_side_validation && index_settings.nil?
    raise ArgumentError, "Parameter `index_settings` is required when calling `set_settings`."
  end

  path = '/1/indexes/{indexName}/settings'.sub('{' + 'indexName' + '}', @api_client.encode_uri(index_name.to_s))
  query_params = {}
  query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(index_settings)

  new_options = request_options.merge(
    :operation => :'SearchClient.set_settings',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:PUT, path, new_options)
end

#update_api_key(key, api_key, request_options = {}) ⇒ UpdateApiKeyResponse

Update an API key. Replace the permissions of an existing API key. Any unspecified parameter resets that permission to its default value. The request must be authenticated with the admin API key.

Parameters:

  • key (String)

    API key. (required)

  • api_key (ApiKey)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:

  • (UpdateApiKeyResponse)


2718
2719
2720
2721
# File 'lib/algolia/api/search_client.rb', line 2718

def update_api_key(key, api_key, request_options = {})
  response = update_api_key_with_http_info(key, api_key, request_options)
  deserialize(response.body, request_options[:debug_return_type] || 'Search::UpdateApiKeyResponse')
end

#update_api_key_with_http_info(key, api_key, request_options = {}) ⇒ Http::Response

Update an API key. Replace the permissions of an existing API key. Any unspecified parameter resets that permission to its default value. The request must be authenticated with the admin API key.

Parameters:

  • key (String)

    API key. (required)

  • api_key (ApiKey)

    (required)

  • request_options:

    The request options to send along with the query, they will be merged with the transporter base parameters (headers, query params, timeouts, etc.). (optional)

Returns:



2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
# File 'lib/algolia/api/search_client.rb', line 2683

def update_api_key_with_http_info(key, api_key, request_options = {})
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    raise ArgumentError, "Parameter `key` is required when calling `update_api_key`."
  end
  # verify the required parameter 'api_key' is set
  if @api_client.config.client_side_validation && api_key.nil?
    raise ArgumentError, "Parameter `api_key` is required when calling `update_api_key`."
  end

  path = '/1/keys/{key}'.sub('{' + 'key' + '}', @api_client.encode_uri(key.to_s))
  query_params = {}
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body] || @api_client.object_to_http_body(api_key)

  new_options = request_options.merge(
    :operation => :'SearchClient.update_api_key',
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

  @api_client.call_api(:PUT, path, new_options)
end