Class: Algolia::SearchClient
- Inherits:
-
Object
- Object
- Algolia::SearchClient
- Defined in:
- lib/algolia/api/search_client.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Class Method Summary collapse
Instance Method Summary collapse
-
#add_api_key(api_key, request_options = {}) ⇒ AddApiKeyResponse
Creates a new API key with specific permissions and restrictions.
-
#add_api_key_with_http_info(api_key, request_options = {}) ⇒ Http::Response
Creates a new API key with specific permissions and restrictions.
-
#add_or_update_object(index_name, object_id, body, request_options = {}) ⇒ UpdatedAtWithObjectIdResponse
If a record with the specified object ID exists, the existing record is replaced.
-
#add_or_update_object_with_http_info(index_name, object_id, body, request_options = {}) ⇒ Http::Response
If a record with the specified object ID exists, the existing record is replaced.
-
#append_source(source, request_options = {}) ⇒ CreatedAtResponse
Adds a source to the list of allowed sources.
-
#append_source_with_http_info(source, request_options = {}) ⇒ Http::Response
Adds a source to the list of allowed sources.
-
#assign_user_id(x_algolia_user_id, assign_user_id_params, request_options = {}) ⇒ CreatedAtResponse
Assigns or moves a user ID to a cluster.
-
#assign_user_id_with_http_info(x_algolia_user_id, assign_user_id_params, request_options = {}) ⇒ Http::Response
Assigns or moves a user ID to a cluster.
- #batch(index_name, batch_write_params, request_options = {}) ⇒ BatchResponse
-
#batch_assign_user_ids(x_algolia_user_id, batch_assign_user_ids_params, request_options = {}) ⇒ CreatedAtResponse
Assigns multiple user IDs to a cluster.
-
#batch_assign_user_ids_with_http_info(x_algolia_user_id, batch_assign_user_ids_params, request_options = {}) ⇒ Http::Response
Assigns multiple user IDs to a cluster.
-
#batch_dictionary_entries(dictionary_name, batch_dictionary_entries_params, request_options = {}) ⇒ UpdatedAtResponse
Adds or deletes multiple entries from your plurals, segmentation, or stop word dictionaries.
-
#batch_dictionary_entries_with_http_info(dictionary_name, batch_dictionary_entries_params, request_options = {}) ⇒ Http::Response
Adds or deletes multiple entries from your plurals, segmentation, or stop word dictionaries.
-
#batch_with_http_info(index_name, batch_write_params, request_options = {}) ⇒ Http::Response
The response.
-
#browse(index_name, browse_params = nil, request_options = {}) ⇒ BrowseResponse
Retrieves records from an index, up to 1,000 per request.
-
#browse_objects(index_name, browse_params = Search::BrowseParamsObject.new, request_options = {}, &block) ⇒ Object
Helper: Iterate on the ‘browse` method of the client to allow aggregating objects of an index.
-
#browse_rules(index_name, search_rules_params = Search::SearchRulesParams.new(hits_per_page: 1000, page: 0), request_options = {}, &block) ⇒ Object
Helper: Iterate on the ‘searchRules` method of the client to allow aggregating rules of an index.
-
#browse_synonyms(index_name, search_synonyms_params = Search::SearchSynonymsParams.new(hits_per_page: 1000, page: 0), request_options = {}, &block) ⇒ Object
Helper: Iterate on the ‘searchSynonyms` method of the client to allow aggregating synonyms of an index.
-
#browse_with_http_info(index_name, browse_params = nil, request_options = {}) ⇒ Http::Response
Retrieves records from an index, up to 1,000 per request.
-
#clear_objects(index_name, request_options = {}) ⇒ UpdatedAtResponse
Deletes only the records from an index while keeping settings, synonyms, and rules.
-
#clear_objects_with_http_info(index_name, request_options = {}) ⇒ Http::Response
Deletes only the records from an index while keeping settings, synonyms, and rules.
-
#clear_rules(index_name, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Deletes all rules from the index.
-
#clear_rules_with_http_info(index_name, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Deletes all rules from the index.
-
#clear_synonyms(index_name, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Deletes all synonyms from the index.
-
#clear_synonyms_with_http_info(index_name, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Deletes all synonyms from the index.
- #custom_delete(path, parameters = nil, request_options = {}) ⇒ Object
-
#custom_delete_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response
The response.
- #custom_get(path, parameters = nil, request_options = {}) ⇒ Object
-
#custom_get_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response
The response.
- #custom_post(path, parameters = nil, body = nil, request_options = {}) ⇒ Object
-
#custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response
The response.
- #custom_put(path, parameters = nil, body = nil, request_options = {}) ⇒ Object
-
#custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response
The response.
-
#delete_api_key(key, request_options = {}) ⇒ DeleteApiKeyResponse
Deletes the API key.
-
#delete_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response
Deletes the API key.
-
#delete_by(index_name, delete_by_params, request_options = {}) ⇒ DeletedAtResponse
This operation doesn’t accept empty queries or filters.
-
#delete_by_with_http_info(index_name, delete_by_params, request_options = {}) ⇒ Http::Response
This operation doesn't accept empty queries or filters.
-
#delete_index(index_name, request_options = {}) ⇒ DeletedAtResponse
Deletes an index and all its settings.
-
#delete_index_with_http_info(index_name, request_options = {}) ⇒ Http::Response
Deletes an index and all its settings.
-
#delete_object(index_name, object_id, request_options = {}) ⇒ DeletedAtResponse
Deletes a record by its object ID.
-
#delete_object_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response
Deletes a record by its object ID.
-
#delete_rule(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Deletes a rule by its ID.
-
#delete_rule_with_http_info(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Deletes a rule by its ID.
-
#delete_source(source, request_options = {}) ⇒ DeleteSourceResponse
Deletes a source from the list of allowed sources.
-
#delete_source_with_http_info(source, request_options = {}) ⇒ Http::Response
Deletes a source from the list of allowed sources.
-
#delete_synonym(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ DeletedAtResponse
Deletes a synonym by its ID.
-
#delete_synonym_with_http_info(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Deletes a synonym by its ID.
- #get_api_key(key, request_options = {}) ⇒ GetApiKeyResponse
-
#get_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response
The response.
-
#get_dictionary_languages(request_options = {}) ⇒ Hash<String, Languages>
Lists supported languages with their supported dictionary types and number of custom entries.
-
#get_dictionary_languages_with_http_info(request_options = {}) ⇒ Http::Response
Lists supported languages with their supported dictionary types and number of custom entries.
-
#get_dictionary_settings(request_options = {}) ⇒ GetDictionarySettingsResponse
Retrieves the languages for which standard dictionary entries are turned off.
-
#get_dictionary_settings_with_http_info(request_options = {}) ⇒ Http::Response
Retrieves the languages for which standard dictionary entries are turned off.
-
#get_logs(offset = nil, length = nil, index_name = nil, type = nil, request_options = {}) ⇒ GetLogsResponse
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).
-
#get_logs_with_http_info(offset = nil, length = nil, index_name = nil, type = nil, request_options = {}) ⇒ Http::Response
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).
-
#get_object(index_name, object_id, attributes_to_retrieve = nil, request_options = {}) ⇒ Hash<String, String>
Retrieves one record by its object ID.
-
#get_object_with_http_info(index_name, object_id, attributes_to_retrieve = nil, request_options = {}) ⇒ Http::Response
Retrieves one record by its object ID.
-
#get_objects(get_objects_params, request_options = {}) ⇒ GetObjectsResponse
Retrieves one or more records, potentially from different indices.
-
#get_objects_with_http_info(get_objects_params, request_options = {}) ⇒ Http::Response
Retrieves one or more records, potentially from different indices.
-
#get_rule(index_name, object_id, request_options = {}) ⇒ Rule
Retrieves a rule by its ID.
-
#get_rule_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response
Retrieves a rule by its ID.
-
#get_settings(index_name, request_options = {}) ⇒ IndexSettings
Retrieves an object with non-null index settings.
-
#get_settings_with_http_info(index_name, request_options = {}) ⇒ Http::Response
Retrieves an object with non-null index settings.
-
#get_sources(request_options = {}) ⇒ Array<Source>
Retrieves all allowed IP addresses with access to your application.
-
#get_sources_with_http_info(request_options = {}) ⇒ Http::Response
Retrieves all allowed IP addresses with access to your application.
-
#get_synonym(index_name, object_id, request_options = {}) ⇒ SynonymHit
Retrieves a syonym by its ID.
-
#get_synonym_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response
Retrieves a syonym by its ID.
-
#get_task(index_name, task_id, request_options = {}) ⇒ GetTaskResponse
Checks the status of a given task.
-
#get_task_with_http_info(index_name, task_id, request_options = {}) ⇒ Http::Response
Checks the status of a given task.
-
#get_top_user_ids(request_options = {}) ⇒ GetTopUserIdsResponse
Get the IDs of the 10 users with the highest number of records per cluster.
-
#get_top_user_ids_with_http_info(request_options = {}) ⇒ Http::Response
Get the IDs of the 10 users with the highest number of records per cluster.
-
#get_user_id(user_id, request_options = {}) ⇒ UserId
Returns the user ID data stored in the mapping.
-
#get_user_id_with_http_info(user_id, request_options = {}) ⇒ Http::Response
Returns the user ID data stored in the mapping.
-
#has_pending_mappings(get_clusters = nil, request_options = {}) ⇒ HasPendingMappingsResponse
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.
-
#has_pending_mappings_with_http_info(get_clusters = nil, request_options = {}) ⇒ Http::Response
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.
-
#initialize(config = nil) ⇒ SearchClient
constructor
A new instance of SearchClient.
-
#list_api_keys(request_options = {}) ⇒ ListApiKeysResponse
Lists all API keys associated with your Algolia application, including their permissions and restrictions.
-
#list_api_keys_with_http_info(request_options = {}) ⇒ Http::Response
Lists all API keys associated with your Algolia application, including their permissions and restrictions.
-
#list_clusters(request_options = {}) ⇒ ListClustersResponse
Lists the available clusters in a multi-cluster setup.
-
#list_clusters_with_http_info(request_options = {}) ⇒ Http::Response
Lists the available clusters in a multi-cluster setup.
-
#list_indices(page = nil, hits_per_page = nil, request_options = {}) ⇒ ListIndicesResponse
Lists all indices in the current Algolia application.
-
#list_indices_with_http_info(page = nil, hits_per_page = nil, request_options = {}) ⇒ Http::Response
Lists all indices in the current Algolia application.
-
#list_user_ids(page = nil, hits_per_page = nil, request_options = {}) ⇒ ListUserIdsResponse
Lists the userIDs assigned to a multi-cluster application.
-
#list_user_ids_with_http_info(page = nil, hits_per_page = nil, request_options = {}) ⇒ Http::Response
Lists the userIDs assigned to a multi-cluster application.
- #multiple_batch(batch_params, request_options = {}) ⇒ MultipleBatchResponse
-
#multiple_batch_with_http_info(batch_params, request_options = {}) ⇒ Http::Response
The response.
-
#operation_index(index_name, operation_index_params, request_options = {}) ⇒ UpdatedAtResponse
Copies or moves (renames) an index within the same Algolia application.
-
#operation_index_with_http_info(index_name, operation_index_params, request_options = {}) ⇒ Http::Response
Copies or moves (renames) an index within the same Algolia application.
-
#partial_update_object(index_name, object_id, attributes_to_update, create_if_not_exists = nil, request_options = {}) ⇒ UpdatedAtWithObjectIdResponse
Adds new attributes to a record, or update existing ones.
-
#partial_update_object_with_http_info(index_name, object_id, attributes_to_update, create_if_not_exists = nil, request_options = {}) ⇒ Http::Response
Adds new attributes to a record, or update existing ones.
-
#remove_user_id(user_id, request_options = {}) ⇒ RemoveUserIdResponse
Deletes a user ID and its associated data from the clusters.
-
#remove_user_id_with_http_info(user_id, request_options = {}) ⇒ Http::Response
Deletes a user ID and its associated data from the clusters.
-
#replace_sources(source, request_options = {}) ⇒ ReplaceSourceResponse
Replaces the list of allowed sources.
-
#replace_sources_with_http_info(source, request_options = {}) ⇒ Http::Response
Replaces the list of allowed sources.
-
#restore_api_key(key, request_options = {}) ⇒ AddApiKeyResponse
Restores a deleted API key.
-
#restore_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response
Restores a deleted API key.
-
#save_object(index_name, body, request_options = {}) ⇒ SaveObjectResponse
Adds a record to an index or replace it.
-
#save_object_with_http_info(index_name, body, request_options = {}) ⇒ Http::Response
Adds a record to an index or replace it.
-
#save_rule(index_name, object_id, rule, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedRuleResponse
If a rule with the specified object ID doesn’t exist, it’s created.
-
#save_rule_with_http_info(index_name, object_id, rule, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
If a rule with the specified object ID doesn't exist, it's created.
-
#save_rules(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, request_options = {}) ⇒ UpdatedAtResponse
Create or update multiple rules.
-
#save_rules_with_http_info(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, request_options = {}) ⇒ Http::Response
Create or update multiple rules.
-
#save_synonym(index_name, object_id, synonym_hit, forward_to_replicas = nil, request_options = {}) ⇒ SaveSynonymResponse
If a synonym with the specified object ID doesn’t exist, Algolia adds a new one.
-
#save_synonym_with_http_info(index_name, object_id, synonym_hit, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
If a synonym with the specified object ID doesn't exist, Algolia adds a new one.
-
#save_synonyms(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, request_options = {}) ⇒ UpdatedAtResponse
If a synonym with the ‘objectID` doesn’t exist, Algolia adds a new one.
-
#save_synonyms_with_http_info(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, request_options = {}) ⇒ Http::Response
If a synonym with the `objectID` doesn't exist, Algolia adds a new one.
-
#search(search_method_params, request_options = {}) ⇒ SearchResponses
Sends multiple search request to one or more indices.
-
#search_dictionary_entries(dictionary_name, search_dictionary_entries_params, request_options = {}) ⇒ SearchDictionaryEntriesResponse
Searches for standard and custom dictionary entries.
-
#search_dictionary_entries_with_http_info(dictionary_name, search_dictionary_entries_params, request_options = {}) ⇒ Http::Response
Searches for standard and custom dictionary entries.
-
#search_for_facet_values(index_name, facet_name, search_for_facet_values_request = nil, request_options = {}) ⇒ SearchForFacetValuesResponse
Searches for values of a specified facet attribute.
-
#search_for_facet_values_with_http_info(index_name, facet_name, search_for_facet_values_request = nil, request_options = {}) ⇒ Http::Response
Searches for values of a specified facet attribute.
-
#search_rules(index_name, search_rules_params = nil, request_options = {}) ⇒ SearchRulesResponse
Searches for rules in your index.
-
#search_rules_with_http_info(index_name, search_rules_params = nil, request_options = {}) ⇒ Http::Response
Searches for rules in your index.
-
#search_single_index(index_name, search_params = nil, request_options = {}) ⇒ SearchResponse
Searches a single index and return matching search results (hits).
-
#search_single_index_with_http_info(index_name, search_params = nil, request_options = {}) ⇒ Http::Response
Searches a single index and return matching search results (hits).
-
#search_synonyms(index_name, search_synonyms_params = nil, request_options = {}) ⇒ SearchSynonymsResponse
Searches for synonyms in your index.
-
#search_synonyms_with_http_info(index_name, search_synonyms_params = nil, request_options = {}) ⇒ Http::Response
Searches for synonyms in your index.
-
#search_user_ids(search_user_ids_params, request_options = {}) ⇒ SearchUserIdsResponse
Since it can take a few seconds to get the data from the different clusters, the response isn’t real-time.
-
#search_user_ids_with_http_info(search_user_ids_params, request_options = {}) ⇒ Http::Response
Since it can take a few seconds to get the data from the different clusters, the response isn't real-time.
-
#search_with_http_info(search_method_params, request_options = {}) ⇒ Http::Response
Sends multiple search request to one or more indices.
-
#set_dictionary_settings(dictionary_settings_params, request_options = {}) ⇒ UpdatedAtResponse
Turns standard stop word dictionary entries on or off for a given language.
-
#set_dictionary_settings_with_http_info(dictionary_settings_params, request_options = {}) ⇒ Http::Response
Turns standard stop word dictionary entries on or off for a given language.
-
#set_settings(index_name, index_settings, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Update the specified index settings.
-
#set_settings_with_http_info(index_name, index_settings, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Update the specified index settings.
-
#update_api_key(key, api_key, request_options = {}) ⇒ UpdateApiKeyResponse
Replaces the permissions of an existing API key.
-
#update_api_key_with_http_info(key, api_key, request_options = {}) ⇒ Http::Response
Replaces the permissions of an existing API key.
-
#wait_for_api_key(operation, key, api_key = {}, max_retries = 50, timeout = ->(retry_count) { [retry_count * 200, 5000].min }, request_options = {}) ⇒ Http::Response
Helper: Wait for an API key to be added, updated or deleted based on a given ‘operation`.
-
#wait_for_task(index_name, task_id, max_retries = 50, timeout = ->(retry_count) { [retry_count * 200, 5000].min }, request_options = {}) ⇒ Http::Response
Helper: Wait for a task to be published (completed) for a given ‘index_name` and `task_id`.
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_client ⇒ Object
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 |
# 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
28 29 30 |
# File 'lib/algolia/api/search_client.rb', line 28 def self.create_with_config(config) new(config) end |
Instance Method Details
#add_api_key(api_key, request_options = {}) ⇒ AddApiKeyResponse
Creates a new API key with specific permissions and restrictions.
Required API Key ACLs:
- admin
71 72 73 74 |
# File 'lib/algolia/api/search_client.rb', line 71 def add_api_key(api_key, = {}) response = add_api_key_with_http_info(api_key, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::AddApiKeyResponse') end |
#add_api_key_with_http_info(api_key, request_options = {}) ⇒ Http::Response
Creates a new API key with specific permissions and restrictions.
Required API Key ACLs:
- admin
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/algolia/api/search_client.rb', line 39 def add_api_key_with_http_info(api_key, = {}) # 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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(api_key) = .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, ) end |
#add_or_update_object(index_name, object_id, body, request_options = {}) ⇒ UpdatedAtWithObjectIdResponse
If a record with the specified object ID exists, the existing record is replaced. Otherwise, a new record is added to the index. To update some attributes of an existing record, use the [‘partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add, update, or replace multiple records, use the [`batch` operation](#tag/Records/operation/batch).
Required API Key ACLs:
- addObject
128 129 130 131 |
# File 'lib/algolia/api/search_client.rb', line 128 def add_or_update_object(index_name, object_id, body, = {}) response = add_or_update_object_with_http_info(index_name, object_id, body, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtWithObjectIdResponse') end |
#add_or_update_object_with_http_info(index_name, object_id, body, request_options = {}) ⇒ Http::Response
If a record with the specified object ID exists, the existing record is replaced. Otherwise, a new record is added to the index. To update some attributes of an existing record, use the [`partial` operation](#tag/Records/operation/partialUpdateObject) instead. To add, update, or replace multiple records, use the [`batch` operation](#tag/Records/operation/batch).
Required API Key ACLs:
- addObject
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 113 114 115 116 117 |
# File 'lib/algolia/api/search_client.rb', line 85 def add_or_update_object_with_http_info(index_name, object_id, body, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', Transport.encode_uri(object_id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(body) = .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, ) end |
#append_source(source, request_options = {}) ⇒ CreatedAtResponse
Adds a source to the list of allowed sources.
Required API Key ACLs:
- admin
172 173 174 175 |
# File 'lib/algolia/api/search_client.rb', line 172 def append_source(source, = {}) response = append_source_with_http_info(source, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::CreatedAtResponse') end |
#append_source_with_http_info(source, request_options = {}) ⇒ Http::Response
Adds a source to the list of allowed sources.
Required API Key ACLs:
- admin
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/algolia/api/search_client.rb', line 140 def append_source_with_http_info(source, = {}) # 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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(source) = .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, ) end |
#assign_user_id(x_algolia_user_id, assign_user_id_params, request_options = {}) ⇒ CreatedAtResponse
Assigns or moves 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.
Required API Key ACLs:
- admin
229 230 231 232 |
# File 'lib/algolia/api/search_client.rb', line 229 def assign_user_id(x_algolia_user_id, assign_user_id_params, = {}) response = assign_user_id_with_http_info(x_algolia_user_id, assign_user_id_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::CreatedAtResponse') end |
#assign_user_id_with_http_info(x_algolia_user_id, assign_user_id_params, request_options = {}) ⇒ Http::Response
Assigns or moves 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.
Required API Key ACLs:
- admin
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
# File 'lib/algolia/api/search_client.rb', line 185 def assign_user_id_with_http_info(x_algolia_user_id, assign_user_id_params, = {}) # 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([:query_params]) unless [:query_params].nil? header_params = {} header_params[:'X-Algolia-User-ID'] = x_algolia_user_id header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(assign_user_id_params) = .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, ) end |
#batch(index_name, batch_write_params, request_options = {}) ⇒ BatchResponse
275 276 277 278 |
# File 'lib/algolia/api/search_client.rb', line 275 def batch(index_name, batch_write_params, = {}) response = batch_with_http_info(index_name, batch_write_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::BatchResponse') end |
#batch_assign_user_ids(x_algolia_user_id, batch_assign_user_ids_params, request_options = {}) ⇒ CreatedAtResponse
Assigns multiple user IDs to a cluster. **You can’t move users with this operation**.
Required API Key ACLs:
- admin
332 333 334 335 |
# File 'lib/algolia/api/search_client.rb', line 332 def batch_assign_user_ids(x_algolia_user_id, batch_assign_user_ids_params, = {}) response = batch_assign_user_ids_with_http_info(x_algolia_user_id, batch_assign_user_ids_params, ) @api_client.deserialize(response.body, [: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
Assigns multiple user IDs to a cluster. **You can't move users with this operation**.
Required API Key ACLs:
- admin
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
# File 'lib/algolia/api/search_client.rb', line 288 def batch_assign_user_ids_with_http_info(x_algolia_user_id, batch_assign_user_ids_params, = {}) # 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([:query_params]) unless [:query_params].nil? header_params = {} header_params[:'X-Algolia-User-ID'] = x_algolia_user_id header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(batch_assign_user_ids_params) = .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, ) end |
#batch_dictionary_entries(dictionary_name, batch_dictionary_entries_params, request_options = {}) ⇒ UpdatedAtResponse
Adds or deletes multiple entries from your plurals, segmentation, or stop word dictionaries.
Required API Key ACLs:
- editSettings
382 383 384 385 |
# File 'lib/algolia/api/search_client.rb', line 382 def batch_dictionary_entries(dictionary_name, batch_dictionary_entries_params, = {}) response = batch_dictionary_entries_with_http_info(dictionary_name, batch_dictionary_entries_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#batch_dictionary_entries_with_http_info(dictionary_name, batch_dictionary_entries_params, request_options = {}) ⇒ Http::Response
Adds or deletes multiple entries from your plurals, segmentation, or stop word dictionaries.
Required API Key ACLs:
- editSettings
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/algolia/api/search_client.rb', line 345 def batch_dictionary_entries_with_http_info(dictionary_name, batch_dictionary_entries_params, = {}) # 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' + '}', Transport.encode_uri(dictionary_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(batch_dictionary_entries_params) = .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, ) end |
#batch_with_http_info(index_name, batch_write_params, request_options = {}) ⇒ Http::Response
Returns the response.
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/algolia/api/search_client.rb', line 240 def batch_with_http_info(index_name, batch_write_params, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(batch_write_params) = .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, ) end |
#browse(index_name, browse_params = nil, request_options = {}) ⇒ BrowseResponse
Retrieves records from an index, up to 1,000 per request. While searching retrieves hits (records augmented with attributes for highlighting and ranking details), browsing just returns matching records. This can be useful if you want to export your indices. - The Analytics API doesn’t collect data when using ‘browse`. - Records are ranked by attributes and custom ranking. - Deduplication (`distinct`) is turned off. - There’s no ranking for: typo-tolerance, number of matched words, proximity, geo distance.
Required API Key ACLs:
- browse
428 429 430 431 |
# File 'lib/algolia/api/search_client.rb', line 428 def browse(index_name, browse_params = nil, = {}) response = browse_with_http_info(index_name, browse_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::BrowseResponse') end |
#browse_objects(index_name, browse_params = Search::BrowseParamsObject.new, request_options = {}, &block) ⇒ Object
Helper: Iterate on the ‘browse` method of the client to allow aggregating objects of an index.
3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 |
# File 'lib/algolia/api/search_client.rb', line 3002 def browse_objects(index_name, browse_params = Search::BrowseParamsObject.new, = {}, &block) hits = [] loop do res = browse(index_name, browse_params, ) if block_given? res.hits.each do |hit| block.call(hit) end else hits.concat(res.hits) end browse_params.cursor = res.cursor break if browse_params.cursor.nil? end hits unless block_given? end |
#browse_rules(index_name, search_rules_params = Search::SearchRulesParams.new(hits_per_page: 1000, page: 0), request_options = {}, &block) ⇒ Object
Helper: Iterate on the ‘searchRules` method of the client to allow aggregating rules of an index.
3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 |
# File 'lib/algolia/api/search_client.rb', line 3026 def browse_rules(index_name, search_rules_params = Search::SearchRulesParams.new(hits_per_page: 1000, page: 0), = {}, &block) rules = [] loop do res = search_rules(index_name, search_rules_params, ) if block_given? res.hits.each do |rule| block.call(rule) end else rules.concat(res.hits) end search_rules_params.page += 1 break if res.nb_hits < search_rules_params.hits_per_page end rules unless block_given? end |
#browse_synonyms(index_name, search_synonyms_params = Search::SearchSynonymsParams.new(hits_per_page: 1000, page: 0), request_options = {}, &block) ⇒ Object
Helper: Iterate on the ‘searchSynonyms` method of the client to allow aggregating synonyms of an index.
3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 |
# File 'lib/algolia/api/search_client.rb', line 3050 def browse_synonyms(index_name, search_synonyms_params = Search::SearchSynonymsParams.new(hits_per_page: 1000, page: 0), = {}, &block) synonyms = [] loop do res = search_synonyms(index_name, search_synonyms_params, ) if block_given? res.hits.each do |synonym| block.call(synonym) end else synonyms.concat(res.hits) end search_synonyms_params.page += 1 break if res.nb_hits < search_synonyms_params.hits_per_page end synonyms unless block_given? end |
#browse_with_http_info(index_name, browse_params = nil, request_options = {}) ⇒ Http::Response
Retrieves records from an index, up to 1,000 per request. While searching retrieves hits (records augmented with attributes for highlighting and ranking details), browsing just returns matching records. This can be useful if you want to export your indices. - The Analytics API doesn't collect data when using `browse`. - Records are ranked by attributes and custom ranking. - Deduplication (`distinct`) is turned off. - There's no ranking for: typo-tolerance, number of matched words, proximity, geo distance.
Required API Key ACLs:
- browse
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 |
# File 'lib/algolia/api/search_client.rb', line 395 def browse_with_http_info(index_name, browse_params = nil, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(browse_params) = .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, ) end |
#clear_objects(index_name, request_options = {}) ⇒ UpdatedAtResponse
Deletes only the records from an index while keeping settings, synonyms, and rules.
Required API Key ACLs:
- deleteIndex
472 473 474 475 |
# File 'lib/algolia/api/search_client.rb', line 472 def clear_objects(index_name, = {}) response = clear_objects_with_http_info(index_name, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#clear_objects_with_http_info(index_name, request_options = {}) ⇒ Http::Response
Deletes only the records from an index while keeping settings, synonyms, and rules.
Required API Key ACLs:
- deleteIndex
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/algolia/api/search_client.rb', line 440 def clear_objects_with_http_info(index_name, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#clear_rules(index_name, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Deletes all rules from the index.
Required API Key ACLs:
- editSettings
519 520 521 522 |
# File 'lib/algolia/api/search_client.rb', line 519 def clear_rules(index_name, forward_to_replicas = nil, = {}) response = clear_rules_with_http_info(index_name, forward_to_replicas, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#clear_rules_with_http_info(index_name, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Deletes all rules from the index.
Required API Key ACLs:
- editSettings
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
# File 'lib/algolia/api/search_client.rb', line 485 def clear_rules_with_http_info(index_name, forward_to_replicas = nil, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#clear_synonyms(index_name, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Deletes all synonyms from the index.
Required API Key ACLs:
- editSettings
566 567 568 569 |
# File 'lib/algolia/api/search_client.rb', line 566 def clear_synonyms(index_name, forward_to_replicas = nil, = {}) response = clear_synonyms_with_http_info(index_name, forward_to_replicas, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#clear_synonyms_with_http_info(index_name, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Deletes all synonyms from the index.
Required API Key ACLs:
- editSettings
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
# File 'lib/algolia/api/search_client.rb', line 532 def clear_synonyms_with_http_info(index_name, forward_to_replicas = nil, = {}) # 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_synonyms`." end path = '/1/indexes/{indexName}/synonyms/clear'.sub('{' + 'indexName' + '}', Transport.encode_uri(index_name.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .merge( :operation => :'SearchClient.clear_synonyms', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => false ) @api_client.call_api(:POST, path, ) end |
#custom_delete(path, parameters = nil, request_options = {}) ⇒ Object
609 610 611 612 |
# File 'lib/algolia/api/search_client.rb', line 609 def custom_delete(path, parameters = nil, = {}) response = custom_delete_with_http_info(path, parameters, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Object') end |
#custom_delete_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response
Returns the response.
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 |
# File 'lib/algolia/api/search_client.rb', line 577 def custom_delete_with_http_info(path, parameters = nil, = {}) # 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 = '/{path}'.sub('{' + 'path' + '}', path.to_s) query_params = {} query_params = query_params.merge(parameters) unless parameters.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#custom_get(path, parameters = nil, request_options = {}) ⇒ Object
652 653 654 655 |
# File 'lib/algolia/api/search_client.rb', line 652 def custom_get(path, parameters = nil, = {}) response = custom_get_with_http_info(path, parameters, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Object') end |
#custom_get_with_http_info(path, parameters = nil, request_options = {}) ⇒ Http::Response
Returns the response.
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 |
# File 'lib/algolia/api/search_client.rb', line 620 def custom_get_with_http_info(path, parameters = nil, = {}) # 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 = '/{path}'.sub('{' + 'path' + '}', path.to_s) query_params = {} query_params = query_params.merge(parameters) unless parameters.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#custom_post(path, parameters = nil, body = nil, request_options = {}) ⇒ Object
697 698 699 700 |
# File 'lib/algolia/api/search_client.rb', line 697 def custom_post(path, parameters = nil, body = nil, = {}) response = custom_post_with_http_info(path, parameters, body, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Object') end |
#custom_post_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response
Returns the response.
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 |
# File 'lib/algolia/api/search_client.rb', line 664 def custom_post_with_http_info(path, parameters = nil, body = nil, = {}) # 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 = '/{path}'.sub('{' + 'path' + '}', path.to_s) query_params = {} query_params = query_params.merge(parameters) unless parameters.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(body) = .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, ) end |
#custom_put(path, parameters = nil, body = nil, request_options = {}) ⇒ Object
742 743 744 745 |
# File 'lib/algolia/api/search_client.rb', line 742 def custom_put(path, parameters = nil, body = nil, = {}) response = custom_put_with_http_info(path, parameters, body, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Object') end |
#custom_put_with_http_info(path, parameters = nil, body = nil, request_options = {}) ⇒ Http::Response
Returns the response.
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 |
# File 'lib/algolia/api/search_client.rb', line 709 def custom_put_with_http_info(path, parameters = nil, body = nil, = {}) # 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 = '/{path}'.sub('{' + 'path' + '}', path.to_s) query_params = {} query_params = query_params.merge(parameters) unless parameters.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(body) = .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, ) end |
#delete_api_key(key, request_options = {}) ⇒ DeleteApiKeyResponse
Deletes the API key.
Required API Key ACLs:
- admin
786 787 788 789 |
# File 'lib/algolia/api/search_client.rb', line 786 def delete_api_key(key, = {}) response = delete_api_key_with_http_info(key, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::DeleteApiKeyResponse') end |
#delete_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response
Deletes the API key.
Required API Key ACLs:
- admin
754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 |
# File 'lib/algolia/api/search_client.rb', line 754 def delete_api_key_with_http_info(key, = {}) # 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' + '}', Transport.encode_uri(key.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#delete_by(index_name, delete_by_params, request_options = {}) ⇒ DeletedAtResponse
This operation doesn’t accept empty queries or filters. It’s more efficient to get a list of object IDs with the [‘browse` operation](#tag/Search/operation/browse), and then delete the records using the [`batch` operation](tag/Records/operation/batch).
Required API Key ACLs:
- deleteIndex
836 837 838 839 |
# File 'lib/algolia/api/search_client.rb', line 836 def delete_by(index_name, delete_by_params, = {}) response = delete_by_with_http_info(index_name, delete_by_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::DeletedAtResponse') end |
#delete_by_with_http_info(index_name, delete_by_params, request_options = {}) ⇒ Http::Response
This operation doesn't accept empty queries or filters. It's more efficient to get a list of object IDs with the [`browse` operation](#tag/Search/operation/browse), and then delete the records using the [`batch` operation](tag/Records/operation/batch).
Required API Key ACLs:
- deleteIndex
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 |
# File 'lib/algolia/api/search_client.rb', line 799 def delete_by_with_http_info(index_name, delete_by_params, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(delete_by_params) = .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, ) end |
#delete_index(index_name, request_options = {}) ⇒ DeletedAtResponse
Deletes an index and all its settings. - Deleting an index doesn’t delete its analytics data. - If you try to delete a non-existing index, the operation is ignored without warning. - If the index you want to delete has replica indices, the replicas become independent indices. - If the index you want to delete is a replica index, you must first unlink it from its primary index before you can delete it. For more information, see [Delete replica indices](www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/deleting-replicas/).
Required API Key ACLs:
- deleteIndex
880 881 882 883 |
# File 'lib/algolia/api/search_client.rb', line 880 def delete_index(index_name, = {}) response = delete_index_with_http_info(index_name, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::DeletedAtResponse') end |
#delete_index_with_http_info(index_name, request_options = {}) ⇒ Http::Response
Deletes an index and all its settings. - Deleting an index doesn't delete its analytics data. - If you try to delete a non-existing index, the operation is ignored without warning. - If the index you want to delete has replica indices, the replicas become independent indices. - If the index you want to delete is a replica index, you must first unlink it from its primary index before you can delete it. For more information, see [Delete replica indices](www.algolia.com/doc/guides/managing-results/refine-results/sorting/how-to/deleting-replicas/).
Required API Key ACLs:
- deleteIndex
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 |
# File 'lib/algolia/api/search_client.rb', line 848 def delete_index_with_http_info(index_name, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#delete_object(index_name, object_id, request_options = {}) ⇒ DeletedAtResponse
Deletes a record by its object ID. To delete more than one record, use the [‘batch` operation](#tag/Records/operation/batch). To delete records matching a query, use the [`deleteByQuery` operation](#tag/Records/operation/deleteBy).
Required API Key ACLs:
- deleteObject
931 932 933 934 |
# File 'lib/algolia/api/search_client.rb', line 931 def delete_object(index_name, object_id, = {}) response = delete_object_with_http_info(index_name, object_id, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::DeletedAtResponse') end |
#delete_object_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response
Deletes a record by its object ID. To delete more than one record, use the [`batch` operation](#tag/Records/operation/batch). To delete records matching a query, use the [`deleteByQuery` operation](#tag/Records/operation/deleteBy).
Required API Key ACLs:
- deleteObject
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 918 919 920 921 |
# File 'lib/algolia/api/search_client.rb', line 893 def delete_object_with_http_info(index_name, object_id, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', Transport.encode_uri(object_id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#delete_rule(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Deletes a rule by its ID. To find the object ID for rules, use the [‘search` operation](#tag/Rules/operation/searchRules).
Required API Key ACLs:
- editSettings
985 986 987 988 |
# File 'lib/algolia/api/search_client.rb', line 985 def delete_rule(index_name, object_id, forward_to_replicas = nil, = {}) response = delete_rule_with_http_info(index_name, object_id, forward_to_replicas, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#delete_rule_with_http_info(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Deletes a rule by its ID. To find the object ID for rules, use the [`search` operation](#tag/Rules/operation/searchRules).
Required API Key ACLs:
- editSettings
945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 |
# File 'lib/algolia/api/search_client.rb', line 945 def delete_rule_with_http_info(index_name, object_id, forward_to_replicas = nil, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', Transport.encode_uri(object_id.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#delete_source(source, request_options = {}) ⇒ DeleteSourceResponse
Deletes a source from the list of allowed sources.
Required API Key ACLs:
- admin
1029 1030 1031 1032 |
# File 'lib/algolia/api/search_client.rb', line 1029 def delete_source(source, = {}) response = delete_source_with_http_info(source, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::DeleteSourceResponse') end |
#delete_source_with_http_info(source, request_options = {}) ⇒ Http::Response
Deletes a source from the list of allowed sources.
Required API Key ACLs:
- admin
997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 |
# File 'lib/algolia/api/search_client.rb', line 997 def delete_source_with_http_info(source, = {}) # 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' + '}', Transport.encode_uri(source.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#delete_synonym(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ DeletedAtResponse
Deletes a synonym by its ID. To find the object IDs of your synonyms, use the [‘search` operation](#tag/Synonyms/operation/searchSynonyms).
Required API Key ACLs:
- editSettings
1083 1084 1085 1086 |
# File 'lib/algolia/api/search_client.rb', line 1083 def delete_synonym(index_name, object_id, forward_to_replicas = nil, = {}) response = delete_synonym_with_http_info(index_name, object_id, forward_to_replicas, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::DeletedAtResponse') end |
#delete_synonym_with_http_info(index_name, object_id, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Deletes a synonym by its ID. To find the object IDs of your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
Required API Key ACLs:
- editSettings
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 |
# File 'lib/algolia/api/search_client.rb', line 1043 def delete_synonym_with_http_info(index_name, object_id, forward_to_replicas = nil, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', Transport.encode_uri(object_id.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#get_api_key(key, request_options = {}) ⇒ GetApiKeyResponse
1123 1124 1125 1126 |
# File 'lib/algolia/api/search_client.rb', line 1123 def get_api_key(key, = {}) response = get_api_key_with_http_info(key, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::GetApiKeyResponse') end |
#get_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response
Returns the response.
1093 1094 1095 1096 1097 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 1093 def get_api_key_with_http_info(key, = {}) # 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' + '}', Transport.encode_uri(key.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#get_dictionary_languages(request_options = {}) ⇒ Hash<String, Languages>
Lists supported languages with their supported dictionary types and number of custom entries.
Required API Key ACLs:
- settings
1160 1161 1162 1163 |
# File 'lib/algolia/api/search_client.rb', line 1160 def get_dictionary_languages( = {}) response = get_dictionary_languages_with_http_info() @api_client.deserialize(response.body, [:debug_return_type] || 'Search::Hash<String, Languages>') end |
#get_dictionary_languages_with_http_info(request_options = {}) ⇒ Http::Response
Lists supported languages with their supported dictionary types and number of custom entries.
Required API Key ACLs:
- settings
1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 |
# File 'lib/algolia/api/search_client.rb', line 1134 def get_dictionary_languages_with_http_info( = {}) path = '/1/dictionaries/*/languages' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#get_dictionary_settings(request_options = {}) ⇒ GetDictionarySettingsResponse
Retrieves the languages for which standard dictionary entries are turned off.
Required API Key ACLs:
- settings
1197 1198 1199 1200 |
# File 'lib/algolia/api/search_client.rb', line 1197 def get_dictionary_settings( = {}) response = get_dictionary_settings_with_http_info() @api_client.deserialize(response.body, [:debug_return_type] || 'Search::GetDictionarySettingsResponse') end |
#get_dictionary_settings_with_http_info(request_options = {}) ⇒ Http::Response
Retrieves the languages for which standard dictionary entries are turned off.
Required API Key ACLs:
- settings
1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 |
# File 'lib/algolia/api/search_client.rb', line 1171 def get_dictionary_settings_with_http_info( = {}) path = '/1/dictionaries/*/settings' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#get_logs(offset = nil, length = nil, index_name = nil, type = nil, request_options = {}) ⇒ GetLogsResponse
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. - Up to 1,000 API requests per server are logged. - 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.
Required API Key ACLs:
- logs
1250 1251 1252 1253 |
# File 'lib/algolia/api/search_client.rb', line 1250 def get_logs(offset = nil, length = nil, index_name = nil, type = nil, = {}) response = get_logs_with_http_info(offset, length, index_name, type, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::GetLogsResponse') end |
#get_logs_with_http_info(offset = nil, length = nil, index_name = nil, type = nil, request_options = {}) ⇒ Http::Response
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. - Up to 1,000 API requests per server are logged. - 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.
Required API Key ACLs:
- logs
1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 |
# File 'lib/algolia/api/search_client.rb', line 1212 def get_logs_with_http_info(offset = nil, length = nil, index_name = nil, type = nil, = {}) 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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#get_object(index_name, object_id, attributes_to_retrieve = nil, request_options = {}) ⇒ Hash<String, String>
Retrieves one record by its object ID. To retrieve more than one record, use the [‘objects` operation](#tag/Records/operation/getObjects).
Required API Key ACLs:
- search
1304 1305 1306 1307 |
# File 'lib/algolia/api/search_client.rb', line 1304 def get_object(index_name, object_id, attributes_to_retrieve = nil, = {}) response = get_object_with_http_info(index_name, object_id, attributes_to_retrieve, ) @api_client.deserialize(response.body, [: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
Retrieves one record by its object ID. To retrieve more than one record, use the [`objects` operation](#tag/Records/operation/getObjects).
Required API Key ACLs:
- search
1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 |
# File 'lib/algolia/api/search_client.rb', line 1264 def get_object_with_http_info(index_name, object_id, attributes_to_retrieve = nil, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', Transport.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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#get_objects(get_objects_params, request_options = {}) ⇒ GetObjectsResponse
Retrieves one or more records, potentially from different indices. Records are returned in the same order as the requests.
Required API Key ACLs:
- search
1348 1349 1350 1351 |
# File 'lib/algolia/api/search_client.rb', line 1348 def get_objects(get_objects_params, = {}) response = get_objects_with_http_info(get_objects_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::GetObjectsResponse') end |
#get_objects_with_http_info(get_objects_params, request_options = {}) ⇒ Http::Response
Retrieves one or more records, potentially from different indices. Records are returned in the same order as the requests.
Required API Key ACLs:
- search
1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 |
# File 'lib/algolia/api/search_client.rb', line 1316 def get_objects_with_http_info(get_objects_params, = {}) # 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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(get_objects_params) = .merge( :operation => :'SearchClient.get_objects', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#get_rule(index_name, object_id, request_options = {}) ⇒ Rule
Retrieves a rule by its ID. To find the object ID of rules, use the [‘search` operation](#tag/Rules/operation/searchRules).
Required API Key ACLs:
- settings
1399 1400 1401 1402 |
# File 'lib/algolia/api/search_client.rb', line 1399 def get_rule(index_name, object_id, = {}) response = get_rule_with_http_info(index_name, object_id, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::Rule') end |
#get_rule_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response
Retrieves a rule by its ID. To find the object ID of rules, use the [`search` operation](#tag/Rules/operation/searchRules).
Required API Key ACLs:
- settings
1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 |
# File 'lib/algolia/api/search_client.rb', line 1361 def get_rule_with_http_info(index_name, object_id, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', Transport.encode_uri(object_id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#get_settings(index_name, request_options = {}) ⇒ IndexSettings
Retrieves an object with non-null index settings.
Required API Key ACLs:
- search
1443 1444 1445 1446 |
# File 'lib/algolia/api/search_client.rb', line 1443 def get_settings(index_name, = {}) response = get_settings_with_http_info(index_name, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::IndexSettings') end |
#get_settings_with_http_info(index_name, request_options = {}) ⇒ Http::Response
Retrieves an object with non-null index settings.
Required API Key ACLs:
- search
1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 |
# File 'lib/algolia/api/search_client.rb', line 1411 def get_settings_with_http_info(index_name, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#get_sources(request_options = {}) ⇒ Array<Source>
Retrieves all allowed IP addresses with access to your application.
Required API Key ACLs:
- admin
1480 1481 1482 1483 |
# File 'lib/algolia/api/search_client.rb', line 1480 def get_sources( = {}) response = get_sources_with_http_info() @api_client.deserialize(response.body, [:debug_return_type] || 'Array<Search::Source>') end |
#get_sources_with_http_info(request_options = {}) ⇒ Http::Response
Retrieves all allowed IP addresses with access to your application.
Required API Key ACLs:
- admin
1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 |
# File 'lib/algolia/api/search_client.rb', line 1454 def get_sources_with_http_info( = {}) path = '/1/security/sources' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#get_synonym(index_name, object_id, request_options = {}) ⇒ SynonymHit
Retrieves a syonym by its ID. To find the object IDs for your synonyms, use the [‘search` operation](#tag/Synonyms/operation/searchSynonyms).
Required API Key ACLs:
- settings
1531 1532 1533 1534 |
# File 'lib/algolia/api/search_client.rb', line 1531 def get_synonym(index_name, object_id, = {}) response = get_synonym_with_http_info(index_name, object_id, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SynonymHit') end |
#get_synonym_with_http_info(index_name, object_id, request_options = {}) ⇒ Http::Response
Retrieves a syonym by its ID. To find the object IDs for your synonyms, use the [`search` operation](#tag/Synonyms/operation/searchSynonyms).
Required API Key ACLs:
- settings
1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 |
# File 'lib/algolia/api/search_client.rb', line 1493 def get_synonym_with_http_info(index_name, object_id, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', Transport.encode_uri(object_id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#get_task(index_name, task_id, request_options = {}) ⇒ GetTaskResponse
Checks the status of a given task. Indexing tasks are asynchronous. When you add, update, or delete records or indices, a task is created on a queue and completed depending on the load on the server. The indexing tasks’ responses include a task ID that you can use to check the status.
Required API Key ACLs:
- addObject
1582 1583 1584 1585 |
# File 'lib/algolia/api/search_client.rb', line 1582 def get_task(index_name, task_id, = {}) response = get_task_with_http_info(index_name, task_id, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::GetTaskResponse') end |
#get_task_with_http_info(index_name, task_id, request_options = {}) ⇒ Http::Response
Checks the status of a given task. Indexing tasks are asynchronous. When you add, update, or delete records or indices, a task is created on a queue and completed depending on the load on the server. The indexing tasks' responses include a task ID that you can use to check the status.
Required API Key ACLs:
- addObject
1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 |
# File 'lib/algolia/api/search_client.rb', line 1544 def get_task_with_http_info(index_name, task_id, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'taskID' + '}', Transport.encode_uri(task_id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#get_top_user_ids(request_options = {}) ⇒ GetTopUserIdsResponse
Get the IDs of the 10 users with the highest number of records per cluster. Since it can take a few seconds to get the data from the different clusters, the response isn’t real-time.
Required API Key ACLs:
- admin
1619 1620 1621 1622 |
# File 'lib/algolia/api/search_client.rb', line 1619 def get_top_user_ids( = {}) response = get_top_user_ids_with_http_info() @api_client.deserialize(response.body, [:debug_return_type] || 'Search::GetTopUserIdsResponse') end |
#get_top_user_ids_with_http_info(request_options = {}) ⇒ Http::Response
Get the IDs of the 10 users with the highest number of records per cluster. Since it can take a few seconds to get the data from the different clusters, the response isn't real-time.
Required API Key ACLs:
- admin
1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 |
# File 'lib/algolia/api/search_client.rb', line 1593 def get_top_user_ids_with_http_info( = {}) path = '/1/clusters/mapping/top' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#get_user_id(user_id, request_options = {}) ⇒ UserId
Returns the user ID data stored in the mapping. Since it can take a few seconds to get the data from the different clusters, the response isn’t real-time.
Required API Key ACLs:
- admin
1668 1669 1670 1671 |
# File 'lib/algolia/api/search_client.rb', line 1668 def get_user_id(user_id, = {}) response = get_user_id_with_http_info(user_id, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UserId') end |
#get_user_id_with_http_info(user_id, request_options = {}) ⇒ Http::Response
Returns the user ID data stored in the mapping. Since it can take a few seconds to get the data from the different clusters, the response isn't real-time.
Required API Key ACLs:
- admin
1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 |
# File 'lib/algolia/api/search_client.rb', line 1631 def get_user_id_with_http_info(user_id, = {}) # 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' + '}', Transport.encode_uri(user_id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#has_pending_mappings(get_clusters = nil, request_options = {}) ⇒ HasPendingMappingsResponse
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.
Required API Key ACLs:
- admin
1708 1709 1710 1711 |
# File 'lib/algolia/api/search_client.rb', line 1708 def has_pending_mappings(get_clusters = nil, = {}) response = has_pending_mappings_with_http_info(get_clusters, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::HasPendingMappingsResponse') end |
#has_pending_mappings_with_http_info(get_clusters = nil, request_options = {}) ⇒ Http::Response
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.
Required API Key ACLs:
- admin
1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 |
# File 'lib/algolia/api/search_client.rb', line 1680 def has_pending_mappings_with_http_info(get_clusters = nil, = {}) path = '/1/clusters/mapping/pending' query_params = {} query_params[:getClusters] = get_clusters unless get_clusters.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#list_api_keys(request_options = {}) ⇒ ListApiKeysResponse
Lists all API keys associated with your Algolia application, including their permissions and restrictions.
Required API Key ACLs:
- admin
1745 1746 1747 1748 |
# File 'lib/algolia/api/search_client.rb', line 1745 def list_api_keys( = {}) response = list_api_keys_with_http_info() @api_client.deserialize(response.body, [:debug_return_type] || 'Search::ListApiKeysResponse') end |
#list_api_keys_with_http_info(request_options = {}) ⇒ Http::Response
Lists all API keys associated with your Algolia application, including their permissions and restrictions.
Required API Key ACLs:
- admin
1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 |
# File 'lib/algolia/api/search_client.rb', line 1719 def list_api_keys_with_http_info( = {}) path = '/1/keys' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#list_clusters(request_options = {}) ⇒ ListClustersResponse
Lists the available clusters in a multi-cluster setup.
Required API Key ACLs:
- admin
1782 1783 1784 1785 |
# File 'lib/algolia/api/search_client.rb', line 1782 def list_clusters( = {}) response = list_clusters_with_http_info() @api_client.deserialize(response.body, [:debug_return_type] || 'Search::ListClustersResponse') end |
#list_clusters_with_http_info(request_options = {}) ⇒ Http::Response
Lists the available clusters in a multi-cluster setup.
Required API Key ACLs:
- admin
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 1756 def list_clusters_with_http_info( = {}) path = '/1/clusters' query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#list_indices(page = nil, hits_per_page = nil, request_options = {}) ⇒ ListIndicesResponse
Lists all indices in the current Algolia application. The request follows any index restrictions of the API key you use to make the request.
Required API Key ACLs:
- listIndexes
1829 1830 1831 1832 |
# File 'lib/algolia/api/search_client.rb', line 1829 def list_indices(page = nil, hits_per_page = nil, = {}) response = list_indices_with_http_info(page, hits_per_page, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::ListIndicesResponse') end |
#list_indices_with_http_info(page = nil, hits_per_page = nil, request_options = {}) ⇒ Http::Response
Lists all indices in the current Algolia application. The request follows any index restrictions of the API key you use to make the request.
Required API Key ACLs:
- listIndexes
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 1795 def list_indices_with_http_info(page = nil, hits_per_page = nil, = {}) 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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#list_user_ids(page = nil, hits_per_page = nil, request_options = {}) ⇒ ListUserIdsResponse
Lists the userIDs assigned to a multi-cluster application. Since it can take a few seconds to get the data from the different clusters, the response isn’t real-time.
Required API Key ACLs:
- admin
1876 1877 1878 1879 |
# File 'lib/algolia/api/search_client.rb', line 1876 def list_user_ids(page = nil, hits_per_page = nil, = {}) response = list_user_ids_with_http_info(page, hits_per_page, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::ListUserIdsResponse') end |
#list_user_ids_with_http_info(page = nil, hits_per_page = nil, request_options = {}) ⇒ Http::Response
Lists the userIDs assigned to a multi-cluster application. Since it can take a few seconds to get the data from the different clusters, the response isn't real-time.
Required API Key ACLs:
- admin
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 |
# File 'lib/algolia/api/search_client.rb', line 1842 def list_user_ids_with_http_info(page = nil, hits_per_page = nil, = {}) 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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#multiple_batch(batch_params, request_options = {}) ⇒ MultipleBatchResponse
1916 1917 1918 1919 |
# File 'lib/algolia/api/search_client.rb', line 1916 def multiple_batch(batch_params, = {}) response = multiple_batch_with_http_info(batch_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::MultipleBatchResponse') end |
#multiple_batch_with_http_info(batch_params, request_options = {}) ⇒ Http::Response
Returns the response.
1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 |
# File 'lib/algolia/api/search_client.rb', line 1886 def multiple_batch_with_http_info(batch_params, = {}) # 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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(batch_params) = .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, ) end |
#operation_index(index_name, operation_index_params, request_options = {}) ⇒ UpdatedAtResponse
Copies or moves (renames) an index within the same Algolia application. - Existing destination indices are overwritten, except for index-specific API keys and analytics data. - If the destination index doesn’t exist yet, it’ll be created. Copy - Copying a source index that doesn’t exist creates a new index with 0 records and default settings. - The API keys of the source index are merged with the existing keys in the destination index. - You can’t copy the ‘enableReRanking`, `mode`, and `replicas` settings. - You can’t copy to a destination index that already has replicas. - Be aware of the [size limits](www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits). - Related guide: [Copy indices](www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/copy-indices/) Move - Moving a source index that doesn’t exist is ignored without returning an error. - When moving an index, the analytics data keep their original name and a new set of analytics data is started for the new name. To access the original analytics in the dashboard, create an index with the original name. - If the destination index has replicas, moving will overwrite the existing index and copy the data to the replica indices. - Related guide: [Move indices](www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/move-indices/).
Required API Key ACLs:
- addObject
1966 1967 1968 1969 |
# File 'lib/algolia/api/search_client.rb', line 1966 def operation_index(index_name, operation_index_params, = {}) response = operation_index_with_http_info(index_name, operation_index_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#operation_index_with_http_info(index_name, operation_index_params, request_options = {}) ⇒ Http::Response
Copies or moves (renames) an index within the same Algolia application. - Existing destination indices are overwritten, except for index-specific API keys and analytics data. - If the destination index doesn't exist yet, it'll be created. Copy - Copying a source index that doesn't exist creates a new index with 0 records and default settings. - The API keys of the source index are merged with the existing keys in the destination index. - You can't copy the `enableReRanking`, `mode`, and `replicas` settings. - You can't copy to a destination index that already has replicas. - Be aware of the [size limits](www.algolia.com/doc/guides/scaling/algolia-service-limits/#application-record-and-index-limits). - Related guide: [Copy indices](www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/copy-indices/) Move - Moving a source index that doesn't exist is ignored without returning an error. - When moving an index, the analytics data keep their original name and a new set of analytics data is started for the new name. To access the original analytics in the dashboard, create an index with the original name. - If the destination index has replicas, moving will overwrite the existing index and copy the data to the replica indices. - Related guide: [Move indices](www.algolia.com/doc/guides/sending-and-managing-data/manage-indices-and-apps/manage-indices/how-to/move-indices/).
Required API Key ACLs:
- addObject
1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 |
# File 'lib/algolia/api/search_client.rb', line 1929 def operation_index_with_http_info(index_name, operation_index_params, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(operation_index_params) = .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, ) end |
#partial_update_object(index_name, object_id, attributes_to_update, create_if_not_exists = nil, request_options = {}) ⇒ UpdatedAtWithObjectIdResponse
Adds new attributes to a record, or update existing ones. - If a record with the specified object ID doesn’t exist, a new record is added to the index if ‘createIfNotExists` is true. - If the index doesn’t exist yet, this method creates a new index. - You can use any first-level attribute but not nested attributes. If you specify a nested attribute, the engine treats it as a replacement for its first-level ancestor.
Required API Key ACLs:
- addObject
2026 2027 2028 2029 |
# File 'lib/algolia/api/search_client.rb', line 2026 def partial_update_object(index_name, object_id, attributes_to_update, create_if_not_exists = nil, = {}) response = partial_update_object_with_http_info(index_name, object_id, attributes_to_update, create_if_not_exists, ) @api_client.deserialize(response.body, [: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
Adds new attributes to a record, or update existing ones. - If a record with the specified object ID doesn't exist, a new record is added to the index if `createIfNotExists` is true. - If the index doesn't exist yet, this method creates a new index. - You can use any first-level attribute but not nested attributes. If you specify a nested attribute, the engine treats it as a replacement for its first-level ancestor.
Required API Key ACLs:
- addObject
1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 |
# File 'lib/algolia/api/search_client.rb', line 1981 def partial_update_object_with_http_info(index_name, object_id, attributes_to_update, create_if_not_exists = nil, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', Transport.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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(attributes_to_update) = .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, ) end |
#remove_user_id(user_id, request_options = {}) ⇒ RemoveUserIdResponse
Deletes a user ID and its associated data from the clusters.
Required API Key ACLs:
- admin
2075 2076 2077 2078 |
# File 'lib/algolia/api/search_client.rb', line 2075 def remove_user_id(user_id, = {}) response = remove_user_id_with_http_info(user_id, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::RemoveUserIdResponse') end |
#remove_user_id_with_http_info(user_id, request_options = {}) ⇒ Http::Response
Deletes a user ID and its associated data from the clusters.
Required API Key ACLs:
- admin
2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 |
# File 'lib/algolia/api/search_client.rb', line 2038 def remove_user_id_with_http_info(user_id, = {}) # 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' + '}', Transport.encode_uri(user_id.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#replace_sources(source, request_options = {}) ⇒ ReplaceSourceResponse
Replaces the list of allowed sources.
Required API Key ACLs:
- admin
2119 2120 2121 2122 |
# File 'lib/algolia/api/search_client.rb', line 2119 def replace_sources(source, = {}) response = replace_sources_with_http_info(source, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::ReplaceSourceResponse') end |
#replace_sources_with_http_info(source, request_options = {}) ⇒ Http::Response
Replaces the list of allowed sources.
Required API Key ACLs:
- admin
2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 |
# File 'lib/algolia/api/search_client.rb', line 2087 def replace_sources_with_http_info(source, = {}) # 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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(source) = .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, ) end |
#restore_api_key(key, request_options = {}) ⇒ AddApiKeyResponse
Restores a deleted API key. Restoring resets the ‘validity` attribute to `0`. Algolia stores up to 1,000 API keys per application. If you create more, the oldest API keys are deleted and can’t be restored.
Required API Key ACLs:
- admin
2163 2164 2165 2166 |
# File 'lib/algolia/api/search_client.rb', line 2163 def restore_api_key(key, = {}) response = restore_api_key_with_http_info(key, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::AddApiKeyResponse') end |
#restore_api_key_with_http_info(key, request_options = {}) ⇒ Http::Response
Restores a deleted API key. Restoring resets the `validity` attribute to `0`. Algolia stores up to 1,000 API keys per application. If you create more, the oldest API keys are deleted and can't be restored.
Required API Key ACLs:
- admin
2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 |
# File 'lib/algolia/api/search_client.rb', line 2131 def restore_api_key_with_http_info(key, = {}) # 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' + '}', Transport.encode_uri(key.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] = .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, ) end |
#save_object(index_name, body, request_options = {}) ⇒ SaveObjectResponse
Adds a record to an index or replace it. - If the record doesn’t have an object ID, a new record with an auto-generated object ID is added to your index. - If a record with the specified object ID exists, the existing record is replaced. - If a record with the specified object ID doesn’t exist, a new record is added to your index. - If you add a record to an index that doesn’t exist yet, a new index is created. To update some attributes of a record, use the [‘partial` operation](#tag/Records/operation/partial). To add, update, or replace multiple records, use the [`batch` operation](#tag/Records/operation/batch).
Required API Key ACLs:
- addObject
2213 2214 2215 2216 |
# File 'lib/algolia/api/search_client.rb', line 2213 def save_object(index_name, body, = {}) response = save_object_with_http_info(index_name, body, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SaveObjectResponse') end |
#save_object_with_http_info(index_name, body, request_options = {}) ⇒ Http::Response
Adds a record to an index or replace it. - If the record doesn't have an object ID, a new record with an auto-generated object ID is added to your index. - If a record with the specified object ID exists, the existing record is replaced. - If a record with the specified object ID doesn't exist, a new record is added to your index. - If you add a record to an index that doesn't exist yet, a new index is created. To update some attributes of a record, use the [`partial` operation](#tag/Records/operation/partial). To add, update, or replace multiple records, use the [`batch` operation](#tag/Records/operation/batch).
Required API Key ACLs:
- addObject
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 |
# File 'lib/algolia/api/search_client.rb', line 2176 def save_object_with_http_info(index_name, body, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(body) = .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, ) end |
#save_rule(index_name, object_id, rule, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedRuleResponse
If a rule with the specified object ID doesn’t exist, it’s created. Otherwise, the existing rule is replaced. To create or update more than one rule, use the [‘batch` operation](#tag/Rules/operation/saveRules).
Required API Key ACLs:
- editSettings
2273 2274 2275 2276 |
# File 'lib/algolia/api/search_client.rb', line 2273 def save_rule(index_name, object_id, rule, forward_to_replicas = nil, = {}) response = save_rule_with_http_info(index_name, object_id, rule, forward_to_replicas, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedRuleResponse') end |
#save_rule_with_http_info(index_name, object_id, rule, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
If a rule with the specified object ID doesn't exist, it's created. Otherwise, the existing rule is replaced. To create or update more than one rule, use the [`batch` operation](#tag/Rules/operation/saveRules).
Required API Key ACLs:
- editSettings
2228 2229 2230 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 2261 |
# File 'lib/algolia/api/search_client.rb', line 2228 def save_rule_with_http_info(index_name, object_id, rule, forward_to_replicas = nil, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', Transport.encode_uri(object_id.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(rule) = .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, ) end |
#save_rules(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, request_options = {}) ⇒ UpdatedAtResponse
Create or update multiple rules. If a rule with the specified object ID doesn’t exist, Algolia creates a new one. Otherwise, existing rules are replaced.
Required API Key ACLs:
- editSettings
2329 2330 2331 2332 |
# File 'lib/algolia/api/search_client.rb', line 2329 def save_rules(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, = {}) response = save_rules_with_http_info(index_name, rules, forward_to_replicas, clear_existing_rules, ) @api_client.deserialize(response.body, [: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
Create or update multiple rules. If a rule with the specified object ID doesn't exist, Algolia creates a new one. Otherwise, existing rules are replaced.
Required API Key ACLs:
- editSettings
2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 |
# File 'lib/algolia/api/search_client.rb', line 2288 def save_rules_with_http_info(index_name, rules, forward_to_replicas = nil, clear_existing_rules = nil, = {}) # 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' + '}', Transport.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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(rules) = .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, ) end |
#save_synonym(index_name, object_id, synonym_hit, forward_to_replicas = nil, request_options = {}) ⇒ SaveSynonymResponse
If a synonym with the specified object ID doesn’t exist, Algolia adds a new one. Otherwise, the existing synonym is replaced. To add multiple synonyms in a single API request, use the [‘batch` operation](#tag/Synonyms/operation/saveSynonyms).
Required API Key ACLs:
- editSettings
2389 2390 2391 2392 |
# File 'lib/algolia/api/search_client.rb', line 2389 def save_synonym(index_name, object_id, synonym_hit, forward_to_replicas = nil, = {}) response = save_synonym_with_http_info(index_name, object_id, synonym_hit, forward_to_replicas, ) @api_client.deserialize(response.body, [: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
If a synonym with the specified object ID doesn't exist, Algolia adds a new one. Otherwise, the existing synonym is replaced. To add multiple synonyms in a single API request, use the [`batch` operation](#tag/Synonyms/operation/saveSynonyms).
Required API Key ACLs:
- editSettings
2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 |
# File 'lib/algolia/api/search_client.rb', line 2344 def save_synonym_with_http_info(index_name, object_id, synonym_hit, forward_to_replicas = nil, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'objectID' + '}', Transport.encode_uri(object_id.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(synonym_hit) = .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, ) end |
#save_synonyms(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, request_options = {}) ⇒ UpdatedAtResponse
If a synonym with the ‘objectID` doesn’t exist, Algolia adds a new one. Otherwise, existing synonyms are replaced.
Required API Key ACLs:
- editSettings
2445 2446 2447 2448 |
# File 'lib/algolia/api/search_client.rb', line 2445 def save_synonyms(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, = {}) response = save_synonyms_with_http_info(index_name, synonym_hit, forward_to_replicas, replace_existing_synonyms, ) @api_client.deserialize(response.body, [: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
If a synonym with the `objectID` doesn't exist, Algolia adds a new one. Otherwise, existing synonyms are replaced.
Required API Key ACLs:
- editSettings
2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 |
# File 'lib/algolia/api/search_client.rb', line 2404 def save_synonyms_with_http_info(index_name, synonym_hit, forward_to_replicas = nil, replace_existing_synonyms = nil, = {}) # 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' + '}', Transport.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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(synonym_hit) = .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, ) end |
#search(search_method_params, request_options = {}) ⇒ SearchResponses
Sends multiple search request to one or more indices. This can be useful in these cases: - Different indices for different purposes, such as, one index for products, another one for marketing content. - Multiple searches to the same index—for example, with different filters.
Required API Key ACLs:
- search
2489 2490 2491 2492 |
# File 'lib/algolia/api/search_client.rb', line 2489 def search(search_method_params, = {}) response = search_with_http_info(search_method_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SearchResponses') end |
#search_dictionary_entries(dictionary_name, search_dictionary_entries_params, request_options = {}) ⇒ SearchDictionaryEntriesResponse
Searches for standard and custom dictionary entries.
Required API Key ACLs:
- settings
2539 2540 2541 2542 |
# File 'lib/algolia/api/search_client.rb', line 2539 def search_dictionary_entries(dictionary_name, search_dictionary_entries_params, = {}) response = search_dictionary_entries_with_http_info(dictionary_name, search_dictionary_entries_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SearchDictionaryEntriesResponse') end |
#search_dictionary_entries_with_http_info(dictionary_name, search_dictionary_entries_params, request_options = {}) ⇒ Http::Response
Searches for standard and custom dictionary entries.
Required API Key ACLs:
- settings
2502 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 |
# File 'lib/algolia/api/search_client.rb', line 2502 def search_dictionary_entries_with_http_info(dictionary_name, search_dictionary_entries_params, = {}) # 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' + '}', Transport.encode_uri(dictionary_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(search_dictionary_entries_params) = .merge( :operation => :'SearchClient.search_dictionary_entries', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#search_for_facet_values(index_name, facet_name, search_for_facet_values_request = nil, request_options = {}) ⇒ SearchForFacetValuesResponse
Searches for values of a specified facet attribute. - By default, facet values are sorted by decreasing count. You can adjust this with the ‘sortFacetValueBy` parameter. - Searching for facet values doesn’t work if you have **more than 65 searchable facets and searchable attributes combined**.
Required API Key ACLs:
- search
2592 2593 2594 2595 |
# File 'lib/algolia/api/search_client.rb', line 2592 def search_for_facet_values(index_name, facet_name, search_for_facet_values_request = nil, = {}) response = search_for_facet_values_with_http_info(index_name, facet_name, search_for_facet_values_request, ) @api_client.deserialize(response.body, [: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
Searches for values of a specified facet attribute. - By default, facet values are sorted by decreasing count. You can adjust this with the `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have **more than 65 searchable facets and searchable attributes combined**.
Required API Key ACLs:
- search
2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 |
# File 'lib/algolia/api/search_client.rb', line 2553 def search_for_facet_values_with_http_info(index_name, facet_name, search_for_facet_values_request = nil, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)).sub('{' + 'facetName' + '}', Transport.encode_uri(facet_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(search_for_facet_values_request) = .merge( :operation => :'SearchClient.search_for_facet_values', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#search_rules(index_name, search_rules_params = nil, request_options = {}) ⇒ SearchRulesResponse
Searches for rules in your index.
Required API Key ACLs:
- settings
2638 2639 2640 2641 |
# File 'lib/algolia/api/search_client.rb', line 2638 def search_rules(index_name, search_rules_params = nil, = {}) response = search_rules_with_http_info(index_name, search_rules_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SearchRulesResponse') end |
#search_rules_with_http_info(index_name, search_rules_params = nil, request_options = {}) ⇒ Http::Response
Searches for rules in your index.
Required API Key ACLs:
- settings
2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 |
# File 'lib/algolia/api/search_client.rb', line 2605 def search_rules_with_http_info(index_name, search_rules_params = nil, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(search_rules_params) = .merge( :operation => :'SearchClient.search_rules', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#search_single_index(index_name, search_params = nil, request_options = {}) ⇒ SearchResponse
Searches a single index and return matching search results (hits). This method lets you retrieve up to 1,000 hits. If you need more, use the [‘browse` operation](#tag/Search/operation/browse) or increase the `paginatedLimitedTo` index setting.
Required API Key ACLs:
- search
2684 2685 2686 2687 |
# File 'lib/algolia/api/search_client.rb', line 2684 def search_single_index(index_name, search_params = nil, = {}) response = search_single_index_with_http_info(index_name, search_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SearchResponse') end |
#search_single_index_with_http_info(index_name, search_params = nil, request_options = {}) ⇒ Http::Response
Searches a single index and return matching search results (hits). This method lets you retrieve up to 1,000 hits. If you need more, use the [`browse` operation](#tag/Search/operation/browse) or increase the `paginatedLimitedTo` index setting.
Required API Key ACLs:
- search
2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 |
# File 'lib/algolia/api/search_client.rb', line 2651 def search_single_index_with_http_info(index_name, search_params = nil, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(search_params) = .merge( :operation => :'SearchClient.search_single_index', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#search_synonyms(index_name, search_synonyms_params = nil, request_options = {}) ⇒ SearchSynonymsResponse
Searches for synonyms in your index.
Required API Key ACLs:
- settings
2730 2731 2732 2733 |
# File 'lib/algolia/api/search_client.rb', line 2730 def search_synonyms(index_name, search_synonyms_params = nil, = {}) response = search_synonyms_with_http_info(index_name, search_synonyms_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SearchSynonymsResponse') end |
#search_synonyms_with_http_info(index_name, search_synonyms_params = nil, request_options = {}) ⇒ Http::Response
Searches for synonyms in your index.
Required API Key ACLs:
- settings
2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 |
# File 'lib/algolia/api/search_client.rb', line 2697 def search_synonyms_with_http_info(index_name, search_synonyms_params = nil, = {}) # 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 path = '/1/indexes/{indexName}/synonyms/search'.sub('{' + 'indexName' + '}', Transport.encode_uri(index_name.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(search_synonyms_params) = .merge( :operation => :'SearchClient.search_synonyms', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#search_user_ids(search_user_ids_params, request_options = {}) ⇒ SearchUserIdsResponse
Since it can take 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).
Required API Key ACLs:
- admin
2774 2775 2776 2777 |
# File 'lib/algolia/api/search_client.rb', line 2774 def search_user_ids(search_user_ids_params, = {}) response = search_user_ids_with_http_info(search_user_ids_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::SearchUserIdsResponse') end |
#search_user_ids_with_http_info(search_user_ids_params, request_options = {}) ⇒ Http::Response
Since it can take 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).
Required API Key ACLs:
- admin
2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 |
# File 'lib/algolia/api/search_client.rb', line 2742 def search_user_ids_with_http_info(search_user_ids_params, = {}) # 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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(search_user_ids_params) = .merge( :operation => :'SearchClient.search_user_ids', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#search_with_http_info(search_method_params, request_options = {}) ⇒ Http::Response
Sends multiple search request to one or more indices. This can be useful in these cases: - Different indices for different purposes, such as, one index for products, another one for marketing content. - Multiple searches to the same index—for example, with different filters.
Required API Key ACLs:
- search
2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 |
# File 'lib/algolia/api/search_client.rb', line 2457 def search_with_http_info(search_method_params, = {}) # 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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(search_method_params) = .merge( :operation => :'SearchClient.search', :header_params => header_params, :query_params => query_params, :body => post_body, :use_read_transporter => true ) @api_client.call_api(:POST, path, ) end |
#set_dictionary_settings(dictionary_settings_params, request_options = {}) ⇒ UpdatedAtResponse
Turns standard stop word dictionary entries on or off for a given language.
Required API Key ACLs:
- editSettings
2818 2819 2820 2821 |
# File 'lib/algolia/api/search_client.rb', line 2818 def set_dictionary_settings(dictionary_settings_params, = {}) response = set_dictionary_settings_with_http_info(dictionary_settings_params, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#set_dictionary_settings_with_http_info(dictionary_settings_params, request_options = {}) ⇒ Http::Response
Turns standard stop word dictionary entries on or off for a given language.
Required API Key ACLs:
- editSettings
2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 |
# File 'lib/algolia/api/search_client.rb', line 2786 def set_dictionary_settings_with_http_info(dictionary_settings_params, = {}) # 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([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(dictionary_settings_params) = .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, ) end |
#set_settings(index_name, index_settings, forward_to_replicas = nil, request_options = {}) ⇒ UpdatedAtResponse
Update the specified index settings. Index settings that you don’t specify are left unchanged. Specify ‘null` to reset a setting to its default value. For best performance, update the index settings before you add new records to your index.
Required API Key ACLs:
- editSettings
2871 2872 2873 2874 |
# File 'lib/algolia/api/search_client.rb', line 2871 def set_settings(index_name, index_settings, forward_to_replicas = nil, = {}) response = set_settings_with_http_info(index_name, index_settings, forward_to_replicas, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdatedAtResponse') end |
#set_settings_with_http_info(index_name, index_settings, forward_to_replicas = nil, request_options = {}) ⇒ Http::Response
Update the specified index settings. Index settings that you don't specify are left unchanged. Specify `null` to reset a setting to its default value. For best performance, update the index settings before you add new records to your index.
Required API Key ACLs:
- editSettings
2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 |
# File 'lib/algolia/api/search_client.rb', line 2832 def set_settings_with_http_info(index_name, index_settings, forward_to_replicas = nil, = {}) # 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' + '}', Transport.encode_uri(index_name.to_s)) query_params = {} query_params[:forwardToReplicas] = forward_to_replicas unless forward_to_replicas.nil? query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(index_settings) = .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, ) end |
#update_api_key(key, api_key, request_options = {}) ⇒ UpdateApiKeyResponse
Replaces the permissions of an existing API key. Any unspecified attribute resets that attribute to its default value.
Required API Key ACLs:
- admin
2921 2922 2923 2924 |
# File 'lib/algolia/api/search_client.rb', line 2921 def update_api_key(key, api_key, = {}) response = update_api_key_with_http_info(key, api_key, ) @api_client.deserialize(response.body, [:debug_return_type] || 'Search::UpdateApiKeyResponse') end |
#update_api_key_with_http_info(key, api_key, request_options = {}) ⇒ Http::Response
Replaces the permissions of an existing API key. Any unspecified attribute resets that attribute to its default value.
Required API Key ACLs:
- admin
2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 |
# File 'lib/algolia/api/search_client.rb', line 2884 def update_api_key_with_http_info(key, api_key, = {}) # 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' + '}', Transport.encode_uri(key.to_s)) query_params = {} query_params = query_params.merge([:query_params]) unless [:query_params].nil? header_params = {} header_params = header_params.merge([:header_params]) unless [:header_params].nil? post_body = [:debug_body] || @api_client.object_to_http_body(api_key) = .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, ) end |
#wait_for_api_key(operation, key, api_key = {}, max_retries = 50, timeout = ->(retry_count) { [retry_count * 200, 5000].min }, request_options = {}) ⇒ Http::Response
Helper: Wait for an API key to be added, updated or deleted based on a given ‘operation`.
2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 |
# File 'lib/algolia/api/search_client.rb', line 2957 def wait_for_api_key(operation, key, api_key = {}, max_retries = 50, timeout = ->(retry_count) { [retry_count * 200, 5000].min }, = {}) retries = 0 if operation == 'update' raise ArgumentError, '`api_key` is required when waiting for an `update` operation.' if api_key.nil? while retries < max_retries begin updatad_key = get_api_key(key, ) updated_key_hash = updatad_key.to_hash equals = true api_key.to_hash.each do |k, v| equals &&= updated_key_hash[k] == v end return updatad_key if equals rescue AlgoliaError => e raise e unless e.code == 404 end retries += 1 sleep(timeout.call(retries) / 1000.0) end raise ApiError, "The maximum number of retries exceeded. (#{max_retries})" end while retries < max_retries begin res = get_api_key(key, ) return res if operation == 'add' rescue AlgoliaError => e return res if operation == 'delete' && e.code == 404 end retries += 1 sleep(timeout.call(retries) / 1000.0) end raise ApiError, "The maximum number of retries exceeded. (#{max_retries})" end |
#wait_for_task(index_name, task_id, max_retries = 50, timeout = ->(retry_count) { [retry_count * 200, 5000].min }, request_options = {}) ⇒ Http::Response
Helper: Wait for a task to be published (completed) for a given ‘index_name` and `task_id`.
2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 |
# File 'lib/algolia/api/search_client.rb', line 2934 def wait_for_task(index_name, task_id, max_retries = 50, timeout = ->(retry_count) { [retry_count * 200, 5000].min }, = {}) retries = 0 while retries < max_retries res = get_task(index_name, task_id, ) if res.status == 'published' return res end retries += 1 sleep(timeout.call(retries) / 1000.0) end raise ApiError, "The maximum number of retries exceeded. (#{max_retries})" end |