Class: Algolia::UsageClient

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = nil) ⇒ UsageClient

Returns a new instance of UsageClient.



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

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

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



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

def api_client
  @api_client
end

Class Method Details

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



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/algolia/api/usage_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, "Usage", opts)
  create_with_config(config)
end

.create_with_config(config) ⇒ Object



31
32
33
# File 'lib/algolia/api/usage_client.rb', line 31

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

Instance Method Details

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

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • request_options:

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

Returns:

  • (Object)


73
74
75
76
# File 'lib/algolia/api/usage_client.rb', line 73

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

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

Returns the response.

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • request_options:

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

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/algolia/api/usage_client.rb', line 41

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

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

  post_body = request_options[:debug_body]

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

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

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

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • request_options:

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

Returns:

  • (Object)


116
117
118
119
# File 'lib/algolia/api/usage_client.rb', line 116

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

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

Returns the response.

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • request_options:

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

Returns:



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/algolia/api/usage_client.rb', line 84

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

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

  post_body = request_options[:debug_body]

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

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

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

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

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

Returns:

  • (Object)


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

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

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

Returns the response.

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

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

Returns:



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

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

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

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

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

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

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

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

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

Returns:

  • (Object)


206
207
208
209
# File 'lib/algolia/api/usage_client.rb', line 206

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

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

Returns the response.

Parameters:

  • path (String)

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

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

    Query parameters to apply to the current query.

  • body (Object) (defaults to: nil)

    Parameters to send with the custom request.

  • request_options:

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

Returns:



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/algolia/api/usage_client.rb', line 173

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

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

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

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

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

#get_index_usage(statistic, index_name, start_date, end_date, granularity = nil, request_options = {}) ⇒ IndexUsage

Parameters:

  • statistic (Statistic)

    Usage statistics to retrieve. Use &#x60;*&#x60; to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - &#x60;search_operations&#x60;. All search operations. - &#x60;total_search_operations&#x60;: Sum of all search operations. - &#x60;total_search_requests&#x60;: Sum of all [search requests](support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus &#x60;querysuggestions_total_search_requests&#x60;. - &#x60;queries_operations&#x60;. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - &#x60;multi_queries_operations&#x60;. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - &#x60;acl_operations&#x60;. All ACL operations. - &#x60;total_acl_operations&#x60;. Sum of all ACL operations. - &#x60;get_api_keys_operations&#x60;. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - &#x60;get_api_key_operations&#x60;. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - &#x60;add_api_key_operations&#x60;. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - &#x60;update_api_key_operations&#x60;. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - &#x60;delete_api_key_operations&#x60;. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - &#x60;list_api_key_operations&#x60;. Number of list index API keys operations. **Indexing operations** - &#x60;indexing_operations&#x60;. All indexing operations. - &#x60;total_indexing_operations&#x60;. Sum of all indexing operations. - &#x60;browse_operations&#x60;. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - &#x60;clear_index_operations&#x60;. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - &#x60;copy_move_operations&#x60;. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - &#x60;delete_index_operations&#x60;. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - &#x60;get_log_operations&#x60;. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - &#x60;get_settings_operations&#x60;. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - &#x60;set_settings_operations&#x60;. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - &#x60;list_indices_operations&#x60;. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - &#x60;wait_task_operations&#x60;. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - &#x60;record_operations&#x60;. All record operations. - &#x60;total_records_operations&#x60;. Sum of all record operations. - &#x60;add_record_operations&#x60;. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - &#x60;batch_operations&#x60;. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - &#x60;delete_by_query_operations&#x60;. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - &#x60;delete_record_operations&#x60;. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - &#x60;get_record_operations&#x60;. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - &#x60;partial_update_record_operations&#x60;. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - &#x60;update_record_operations&#x60;. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - &#x60;synonym_operations&#x60;. All synonym operations. - &#x60;total_synonym_operations&#x60;. Sum of all synonym operations. - &#x60;batch_synonym_operations&#x60;. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - &#x60;clear_synonym_operations&#x60;. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - &#x60;delete_synonym_operations&#x60;. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - &#x60;get_synonym_operations&#x60;. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - &#x60;query_synonym_operations&#x60;. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - &#x60;update_synonym_operations&#x60;. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - &#x60;rule_operations&#x60;. All rule operations. - &#x60;total_rules_operations&#x60;. Sum of all rule operations. - &#x60;batch_rules_operations&#x60;. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - &#x60;clear_rules_operations&#x60;. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - &#x60;delete_rules_operations&#x60;. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - &#x60;get_rules_operations&#x60;. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - &#x60;save_rules_operations&#x60;. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - &#x60;search_rules_operations&#x60;. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - &#x60;total_recommend_requests&#x60;. Number of [Recommend requests](www.algolia.com/doc/guides/algolia-ai/recommend/) - &#x60;total_write_operations&#x60;. Number of Write operations - &#x60;total_read_operations&#x60;. Number of read operations - &#x60;total_operations&#x60;. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of &#x60;total_search_operations&#x60;. - &#x60;querysuggestions_total_search_operations&#x60;. Number of Query Suggestions search operations. - &#x60;querysuggestions_total_search_requests&#x60;. Number of Query Suggestions [search requests](support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - &#x60;querysuggestions_total_acl_operations&#x60;. Sum of all Query Suggestions [ACL operations](#acl-operations). - &#x60;querysuggestions_total_indexing_operations&#x60;. Number of Query Suggestions [indexing operations](#indexing-operations). - &#x60;querysuggestions_total_records_operations&#x60;. Number of Query Suggestions [record operations](#record-operations). - &#x60;querysuggestions_total_synonym_operations&#x60;. Number of Query Suggestions [synonym operations](#synonym-operations). - &#x60;querysuggestions_total_rules_operations&#x60;. Number of Query Suggestions [Rule operations](#rule-operations). - &#x60;querysuggestions_total_write_operations&#x60;. Number of Query Suggestions Write operations. - &#x60;querysuggestions_total_read_operations&#x60;. Number of Query Suggestions Read operations. - &#x60;querysuggestions_total_operations&#x60;. Sum of all Query Suggestions operations. **Processing time** - &#x60;avg_processing_time&#x60;. Average processing time (in milliseconds). - &#x60;90p_processing_time&#x60;. 90th percentile of processing time (in milliseconds). - &#x60;99p_processing_time&#x60;. 99th percentile of processing time (in milliseconds). - &#x60;queries_above_last_ms_processing_time&#x60;. Number of queries that take one or more seconds to process. Indices - &#x60;records&#x60;. Number of records. - &#x60;data_size&#x60;. The size of the records (in bytes). - &#x60;file_size&#x60;. The size of the records and index metadata (in bytes). **Maximum queries per second** - &#x60;max_qps&#x60;. [Maximum queries per second](support.algolia.com/hc/en-us/articles/4406975224721) per server. - &#x60;region_max_qps&#x60;. Maximum queries per second per region. - &#x60;total_max_qps&#x60;. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - &#x60;used_search_capacity&#x60;. Maximum search capacity used per server. - &#x60;avg_used_search_capacity&#x60;. Average search capacity used per server. - &#x60;region_used_search_capacity&#x60;. Maximum search capacity used per region. - &#x60;region_avg_used_search_capacity&#x60;. Average search capacity used per region. - &#x60;total_used_search_capacity&#x60;. Maximum search capacity used for all servers. - &#x60;total_avg_used_search_capacity&#x60;. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](support.algolia.com/hc/en-us/articles/4406981934481). - &#x60;degraded_queries_ssd_used_queries_impacted&#x60;. Percentage of degraded queries due to the Algolia search engine having to read from the server&#39;s SSD. - &#x60;degraded_queries_ssd_used_seconds_impacted&#x60;. Percentage of seconds affected by &#x60;ssd_used&#x60; degraded queries. - &#x60;degraded_queries_max_capacity_queries_impacted&#x60;. Percentage of degraded queries due to all search threads being used. - &#x60;degraded_queries_max_capacity_seconds_impacted&#x60;. Percentage of seconds affected by &#x60;max_capacity&#x60; degraded queries. (required)

  • index_name (String)

    Name of the index on which to perform the operation. (required)

  • start_date (String)

    Start date of the period to analyze, in &#x60;YYYY-MM-DD&#x60; format. (required)

  • end_date (String)

    End date of the period to analyze, in &#x60;YYYY-MM-DD&#x60; format. (required)

  • granularity (Granularity) (defaults to: nil)

    Granularity of the aggregated metrics. - &#x60;hourly&#x60;: the maximum time range for hourly metrics is 7 days. - &#x60;daily&#x60;: the maximum time range for daily metrics is 365 days. (default to ‘daily’)

  • request_options:

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

Returns:

  • (IndexUsage)


279
280
281
282
283
284
285
286
287
288
289
# File 'lib/algolia/api/usage_client.rb', line 279

def get_index_usage(statistic, index_name, start_date, end_date, granularity = nil, request_options = {})
  response = get_index_usage_with_http_info(
    statistic,
    index_name,
    start_date,
    end_date,
    granularity,
    request_options
  )
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Usage::IndexUsage")
end

#get_index_usage_with_http_info(statistic, index_name, start_date, end_date, granularity = nil, request_options = {}) ⇒ Http::Response

Returns the response.

Parameters:

  • statistic (Statistic)

    Usage statistics to retrieve. Use &#x60;*&#x60; to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - &#x60;search_operations&#x60;. All search operations. - &#x60;total_search_operations&#x60;: Sum of all search operations. - &#x60;total_search_requests&#x60;: Sum of all [search requests](support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus &#x60;querysuggestions_total_search_requests&#x60;. - &#x60;queries_operations&#x60;. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - &#x60;multi_queries_operations&#x60;. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - &#x60;acl_operations&#x60;. All ACL operations. - &#x60;total_acl_operations&#x60;. Sum of all ACL operations. - &#x60;get_api_keys_operations&#x60;. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - &#x60;get_api_key_operations&#x60;. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - &#x60;add_api_key_operations&#x60;. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - &#x60;update_api_key_operations&#x60;. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - &#x60;delete_api_key_operations&#x60;. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - &#x60;list_api_key_operations&#x60;. Number of list index API keys operations. **Indexing operations** - &#x60;indexing_operations&#x60;. All indexing operations. - &#x60;total_indexing_operations&#x60;. Sum of all indexing operations. - &#x60;browse_operations&#x60;. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - &#x60;clear_index_operations&#x60;. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - &#x60;copy_move_operations&#x60;. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - &#x60;delete_index_operations&#x60;. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - &#x60;get_log_operations&#x60;. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - &#x60;get_settings_operations&#x60;. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - &#x60;set_settings_operations&#x60;. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - &#x60;list_indices_operations&#x60;. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - &#x60;wait_task_operations&#x60;. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - &#x60;record_operations&#x60;. All record operations. - &#x60;total_records_operations&#x60;. Sum of all record operations. - &#x60;add_record_operations&#x60;. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - &#x60;batch_operations&#x60;. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - &#x60;delete_by_query_operations&#x60;. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - &#x60;delete_record_operations&#x60;. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - &#x60;get_record_operations&#x60;. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - &#x60;partial_update_record_operations&#x60;. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - &#x60;update_record_operations&#x60;. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - &#x60;synonym_operations&#x60;. All synonym operations. - &#x60;total_synonym_operations&#x60;. Sum of all synonym operations. - &#x60;batch_synonym_operations&#x60;. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - &#x60;clear_synonym_operations&#x60;. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - &#x60;delete_synonym_operations&#x60;. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - &#x60;get_synonym_operations&#x60;. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - &#x60;query_synonym_operations&#x60;. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - &#x60;update_synonym_operations&#x60;. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - &#x60;rule_operations&#x60;. All rule operations. - &#x60;total_rules_operations&#x60;. Sum of all rule operations. - &#x60;batch_rules_operations&#x60;. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - &#x60;clear_rules_operations&#x60;. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - &#x60;delete_rules_operations&#x60;. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - &#x60;get_rules_operations&#x60;. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - &#x60;save_rules_operations&#x60;. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - &#x60;search_rules_operations&#x60;. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - &#x60;total_recommend_requests&#x60;. Number of [Recommend requests](www.algolia.com/doc/guides/algolia-ai/recommend/) - &#x60;total_write_operations&#x60;. Number of Write operations - &#x60;total_read_operations&#x60;. Number of read operations - &#x60;total_operations&#x60;. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of &#x60;total_search_operations&#x60;. - &#x60;querysuggestions_total_search_operations&#x60;. Number of Query Suggestions search operations. - &#x60;querysuggestions_total_search_requests&#x60;. Number of Query Suggestions [search requests](support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - &#x60;querysuggestions_total_acl_operations&#x60;. Sum of all Query Suggestions [ACL operations](#acl-operations). - &#x60;querysuggestions_total_indexing_operations&#x60;. Number of Query Suggestions [indexing operations](#indexing-operations). - &#x60;querysuggestions_total_records_operations&#x60;. Number of Query Suggestions [record operations](#record-operations). - &#x60;querysuggestions_total_synonym_operations&#x60;. Number of Query Suggestions [synonym operations](#synonym-operations). - &#x60;querysuggestions_total_rules_operations&#x60;. Number of Query Suggestions [Rule operations](#rule-operations). - &#x60;querysuggestions_total_write_operations&#x60;. Number of Query Suggestions Write operations. - &#x60;querysuggestions_total_read_operations&#x60;. Number of Query Suggestions Read operations. - &#x60;querysuggestions_total_operations&#x60;. Sum of all Query Suggestions operations. **Processing time** - &#x60;avg_processing_time&#x60;. Average processing time (in milliseconds). - &#x60;90p_processing_time&#x60;. 90th percentile of processing time (in milliseconds). - &#x60;99p_processing_time&#x60;. 99th percentile of processing time (in milliseconds). - &#x60;queries_above_last_ms_processing_time&#x60;. Number of queries that take one or more seconds to process. Indices - &#x60;records&#x60;. Number of records. - &#x60;data_size&#x60;. The size of the records (in bytes). - &#x60;file_size&#x60;. The size of the records and index metadata (in bytes). **Maximum queries per second** - &#x60;max_qps&#x60;. [Maximum queries per second](support.algolia.com/hc/en-us/articles/4406975224721) per server. - &#x60;region_max_qps&#x60;. Maximum queries per second per region. - &#x60;total_max_qps&#x60;. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - &#x60;used_search_capacity&#x60;. Maximum search capacity used per server. - &#x60;avg_used_search_capacity&#x60;. Average search capacity used per server. - &#x60;region_used_search_capacity&#x60;. Maximum search capacity used per region. - &#x60;region_avg_used_search_capacity&#x60;. Average search capacity used per region. - &#x60;total_used_search_capacity&#x60;. Maximum search capacity used for all servers. - &#x60;total_avg_used_search_capacity&#x60;. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](support.algolia.com/hc/en-us/articles/4406981934481). - &#x60;degraded_queries_ssd_used_queries_impacted&#x60;. Percentage of degraded queries due to the Algolia search engine having to read from the server&#39;s SSD. - &#x60;degraded_queries_ssd_used_seconds_impacted&#x60;. Percentage of seconds affected by &#x60;ssd_used&#x60; degraded queries. - &#x60;degraded_queries_max_capacity_queries_impacted&#x60;. Percentage of degraded queries due to all search threads being used. - &#x60;degraded_queries_max_capacity_seconds_impacted&#x60;. Percentage of seconds affected by &#x60;max_capacity&#x60; degraded queries. (required)

  • index_name (String)

    Name of the index on which to perform the operation. (required)

  • start_date (String)

    Start date of the period to analyze, in &#x60;YYYY-MM-DD&#x60; format. (required)

  • end_date (String)

    End date of the period to analyze, in &#x60;YYYY-MM-DD&#x60; format. (required)

  • granularity (Granularity) (defaults to: nil)

    Granularity of the aggregated metrics. - &#x60;hourly&#x60;: the maximum time range for hourly metrics is 7 days. - &#x60;daily&#x60;: the maximum time range for daily metrics is 365 days. (default to ‘daily’)

  • request_options:

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

Returns:



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/algolia/api/usage_client.rb', line 220

def get_index_usage_with_http_info(
  statistic,
  index_name,
  start_date,
  end_date,
  granularity = nil,
  request_options = {}
)
  # verify the required parameter 'statistic' is set
  if @api_client.config.client_side_validation && statistic.nil?
    raise ArgumentError, "Parameter `statistic` is required when calling `get_index_usage`."
  end
  # 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_index_usage`."
  end
  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    raise ArgumentError, "Parameter `start_date` is required when calling `get_index_usage`."
  end
  # verify the required parameter 'end_date' is set
  if @api_client.config.client_side_validation && end_date.nil?
    raise ArgumentError, "Parameter `end_date` is required when calling `get_index_usage`."
  end

  path = "/1/usage/{statistic}/{indexName}".sub("{" + "statistic" + "}", Transport.encode_uri(statistic.to_s)).sub(
    "{" + "indexName" + "}",
    Transport.encode_uri(index_name.to_s)
  )
  query_params = {}
  query_params[:startDate] = start_date
  query_params[:endDate] = end_date
  query_params[:granularity] = granularity unless granularity.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :"UsageClient.get_index_usage",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

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

#get_usage(statistic, start_date, end_date, granularity = nil, request_options = {}) ⇒ IndexUsage

Parameters:

  • statistic (Statistic)

    Usage statistics to retrieve. Use &#x60;*&#x60; to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - &#x60;search_operations&#x60;. All search operations. - &#x60;total_search_operations&#x60;: Sum of all search operations. - &#x60;total_search_requests&#x60;: Sum of all [search requests](support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus &#x60;querysuggestions_total_search_requests&#x60;. - &#x60;queries_operations&#x60;. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - &#x60;multi_queries_operations&#x60;. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - &#x60;acl_operations&#x60;. All ACL operations. - &#x60;total_acl_operations&#x60;. Sum of all ACL operations. - &#x60;get_api_keys_operations&#x60;. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - &#x60;get_api_key_operations&#x60;. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - &#x60;add_api_key_operations&#x60;. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - &#x60;update_api_key_operations&#x60;. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - &#x60;delete_api_key_operations&#x60;. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - &#x60;list_api_key_operations&#x60;. Number of list index API keys operations. **Indexing operations** - &#x60;indexing_operations&#x60;. All indexing operations. - &#x60;total_indexing_operations&#x60;. Sum of all indexing operations. - &#x60;browse_operations&#x60;. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - &#x60;clear_index_operations&#x60;. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - &#x60;copy_move_operations&#x60;. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - &#x60;delete_index_operations&#x60;. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - &#x60;get_log_operations&#x60;. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - &#x60;get_settings_operations&#x60;. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - &#x60;set_settings_operations&#x60;. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - &#x60;list_indices_operations&#x60;. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - &#x60;wait_task_operations&#x60;. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - &#x60;record_operations&#x60;. All record operations. - &#x60;total_records_operations&#x60;. Sum of all record operations. - &#x60;add_record_operations&#x60;. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - &#x60;batch_operations&#x60;. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - &#x60;delete_by_query_operations&#x60;. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - &#x60;delete_record_operations&#x60;. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - &#x60;get_record_operations&#x60;. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - &#x60;partial_update_record_operations&#x60;. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - &#x60;update_record_operations&#x60;. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - &#x60;synonym_operations&#x60;. All synonym operations. - &#x60;total_synonym_operations&#x60;. Sum of all synonym operations. - &#x60;batch_synonym_operations&#x60;. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - &#x60;clear_synonym_operations&#x60;. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - &#x60;delete_synonym_operations&#x60;. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - &#x60;get_synonym_operations&#x60;. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - &#x60;query_synonym_operations&#x60;. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - &#x60;update_synonym_operations&#x60;. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - &#x60;rule_operations&#x60;. All rule operations. - &#x60;total_rules_operations&#x60;. Sum of all rule operations. - &#x60;batch_rules_operations&#x60;. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - &#x60;clear_rules_operations&#x60;. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - &#x60;delete_rules_operations&#x60;. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - &#x60;get_rules_operations&#x60;. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - &#x60;save_rules_operations&#x60;. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - &#x60;search_rules_operations&#x60;. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - &#x60;total_recommend_requests&#x60;. Number of [Recommend requests](www.algolia.com/doc/guides/algolia-ai/recommend/) - &#x60;total_write_operations&#x60;. Number of Write operations - &#x60;total_read_operations&#x60;. Number of read operations - &#x60;total_operations&#x60;. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of &#x60;total_search_operations&#x60;. - &#x60;querysuggestions_total_search_operations&#x60;. Number of Query Suggestions search operations. - &#x60;querysuggestions_total_search_requests&#x60;. Number of Query Suggestions [search requests](support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - &#x60;querysuggestions_total_acl_operations&#x60;. Sum of all Query Suggestions [ACL operations](#acl-operations). - &#x60;querysuggestions_total_indexing_operations&#x60;. Number of Query Suggestions [indexing operations](#indexing-operations). - &#x60;querysuggestions_total_records_operations&#x60;. Number of Query Suggestions [record operations](#record-operations). - &#x60;querysuggestions_total_synonym_operations&#x60;. Number of Query Suggestions [synonym operations](#synonym-operations). - &#x60;querysuggestions_total_rules_operations&#x60;. Number of Query Suggestions [Rule operations](#rule-operations). - &#x60;querysuggestions_total_write_operations&#x60;. Number of Query Suggestions Write operations. - &#x60;querysuggestions_total_read_operations&#x60;. Number of Query Suggestions Read operations. - &#x60;querysuggestions_total_operations&#x60;. Sum of all Query Suggestions operations. **Processing time** - &#x60;avg_processing_time&#x60;. Average processing time (in milliseconds). - &#x60;90p_processing_time&#x60;. 90th percentile of processing time (in milliseconds). - &#x60;99p_processing_time&#x60;. 99th percentile of processing time (in milliseconds). - &#x60;queries_above_last_ms_processing_time&#x60;. Number of queries that take one or more seconds to process. Indices - &#x60;records&#x60;. Number of records. - &#x60;data_size&#x60;. The size of the records (in bytes). - &#x60;file_size&#x60;. The size of the records and index metadata (in bytes). **Maximum queries per second** - &#x60;max_qps&#x60;. [Maximum queries per second](support.algolia.com/hc/en-us/articles/4406975224721) per server. - &#x60;region_max_qps&#x60;. Maximum queries per second per region. - &#x60;total_max_qps&#x60;. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - &#x60;used_search_capacity&#x60;. Maximum search capacity used per server. - &#x60;avg_used_search_capacity&#x60;. Average search capacity used per server. - &#x60;region_used_search_capacity&#x60;. Maximum search capacity used per region. - &#x60;region_avg_used_search_capacity&#x60;. Average search capacity used per region. - &#x60;total_used_search_capacity&#x60;. Maximum search capacity used for all servers. - &#x60;total_avg_used_search_capacity&#x60;. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](support.algolia.com/hc/en-us/articles/4406981934481). - &#x60;degraded_queries_ssd_used_queries_impacted&#x60;. Percentage of degraded queries due to the Algolia search engine having to read from the server&#39;s SSD. - &#x60;degraded_queries_ssd_used_seconds_impacted&#x60;. Percentage of seconds affected by &#x60;ssd_used&#x60; degraded queries. - &#x60;degraded_queries_max_capacity_queries_impacted&#x60;. Percentage of degraded queries due to all search threads being used. - &#x60;degraded_queries_max_capacity_seconds_impacted&#x60;. Percentage of seconds affected by &#x60;max_capacity&#x60; degraded queries. (required)

  • start_date (String)

    Start date of the period to analyze, in &#x60;YYYY-MM-DD&#x60; format. (required)

  • end_date (String)

    End date of the period to analyze, in &#x60;YYYY-MM-DD&#x60; format. (required)

  • granularity (Granularity) (defaults to: nil)

    Granularity of the aggregated metrics. - &#x60;hourly&#x60;: the maximum time range for hourly metrics is 7 days. - &#x60;daily&#x60;: the maximum time range for daily metrics is 365 days. (default to ‘daily’)

  • request_options:

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

Returns:

  • (IndexUsage)


343
344
345
346
# File 'lib/algolia/api/usage_client.rb', line 343

def get_usage(statistic, start_date, end_date, granularity = nil, request_options = {})
  response = get_usage_with_http_info(statistic, start_date, end_date, granularity, request_options)
  @api_client.deserialize(response.body, request_options[:debug_return_type] || "Usage::IndexUsage")
end

#get_usage_with_http_info(statistic, start_date, end_date, granularity = nil, request_options = {}) ⇒ Http::Response

Returns the response.

Parameters:

  • statistic (Statistic)

    Usage statistics to retrieve. Use &#x60;*&#x60; to retrieve all usage metrics, otherwise add one or more of the following metrics, separated by a comma. **Search operations** - &#x60;search_operations&#x60;. All search operations. - &#x60;total_search_operations&#x60;: Sum of all search operations. - &#x60;total_search_requests&#x60;: Sum of all [search requests](support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). The number of billed search requests is equal to this value minus &#x60;querysuggestions_total_search_requests&#x60;. - &#x60;queries_operations&#x60;. Number of [single index search](/specs/search#tag/Search/operation/searchSingleIndex) operations. - &#x60;multi_queries_operations&#x60;. Number of [multi-index search](/specs/search#tag/Search/operation/search) operations. **ACL operations** - &#x60;acl_operations&#x60;. All ACL operations. - &#x60;total_acl_operations&#x60;. Sum of all ACL operations. - &#x60;get_api_keys_operations&#x60;. Number of [list API keys](/specs/search#tag/Api-Keys/operation/listApiKeys) operations. - &#x60;get_api_key_operations&#x60;. Number of [get API key permission](/specs/search#tag/Api-Keys/operation/getApiKey) operations. - &#x60;add_api_key_operations&#x60;. Number of [create API key](/specs/search#tag/Api-Keys/operation/addApiKey) operations. - &#x60;update_api_key_operations&#x60;. Number of [update API key](/specs/search#tag/Api-Keys/operation/updateApiKey) operations. - &#x60;delete_api_key_operations&#x60;. Number of [delete API key](/specs/search#tag/Api-Keys/operation/deleteApiKey) operations. - &#x60;list_api_key_operations&#x60;. Number of list index API keys operations. **Indexing operations** - &#x60;indexing_operations&#x60;. All indexing operations. - &#x60;total_indexing_operations&#x60;. Sum of all indexing operations. - &#x60;browse_operations&#x60;. Number of [browse index](/specs/search#tag/Search/operation/browse) operations. - &#x60;clear_index_operations&#x60;. Number of [clear records](/specs/search#tag/Records/operation/clearObjects) operations. - &#x60;copy_move_operations&#x60;. Number of [copy or move index](/specs/search#tag/Indices/operation/operationIndex) operations. - &#x60;delete_index_operations&#x60;. Number of [delete index](/specs/search#tag/Indices/operation/deleteIndex) operations. - &#x60;get_log_operations&#x60;. Number of [get logs](/specs/search#tag/Advanced/operation/getLogs) operations. - &#x60;get_settings_operations&#x60;. Number of [get settings](/specs/search#operation/getIndexUsage) operations. - &#x60;set_settings_operations&#x60;. Number of [set settings](/specs/search#tag/Indices/operation/setSettings) operations. - &#x60;list_indices_operations&#x60;. Number of [list indices](/specs/search#tag/Indices/operation/listIndices) operations. - &#x60;wait_task_operations&#x60;. Number of [wait](/specs/search#tag/Indices/operation/getTask) operations. **Record operations** - &#x60;record_operations&#x60;. All record operations. - &#x60;total_records_operations&#x60;. Sum of all record operations. - &#x60;add_record_operations&#x60;. Number of [add or replace record](/specs/search#tag/Records/operation/saveObject) operations. - &#x60;batch_operations&#x60;. Number of [batch indexing](/specs/search#tag/Records/operation/multipleBatch) operations. - &#x60;delete_by_query_operations&#x60;. Number of [delete by query](/specs/search#tag/Records/operation/deleteBy) operations. - &#x60;delete_record_operations&#x60;. Number of [delete record](/specs/search#tag/Records/operation/deleteObject) operations. - &#x60;get_record_operations&#x60;. Number of [get record](/specs/search#tag/Records/operation/getObject) operations. - &#x60;partial_update_record_operations&#x60;. Number of [partially update records](/specs/search#tag/Records/operation/partialUpdateObject) operations. - &#x60;update_record_operations&#x60;. Number of [add or replace record by objectID](/specs/search#tag/Records/operation/addOrUpdateObject) operations. **Synonym operations** - &#x60;synonym_operations&#x60;. All synonym operations. - &#x60;total_synonym_operations&#x60;. Sum of all synonym operations. - &#x60;batch_synonym_operations&#x60;. Number of [save all synonyms](/specs/search#tag/Synonyms/operation/saveSynonyms) operations. - &#x60;clear_synonym_operations&#x60;. Number of [clear synonyms](/specs/search#tag/Synonyms/operation/clearSynonyms) operations. - &#x60;delete_synonym_operations&#x60;. Number of [delete synonym](/specs/search#tag/Synonyms/operation/deleteSynonym) operations. - &#x60;get_synonym_operations&#x60;. Number of [get synonym](/specs/search#tag/Synonyms/operation/getSynonym) operations. - &#x60;query_synonym_operations&#x60;. Number of [search synonyms](/specs/search#tag/Synonyms/operation/searchSynonyms) operations. - &#x60;update_synonym_operations&#x60;. Number of [save a synonym](/specs/search#tag/Synonyms/operation/saveSynonym) operations. **Rule operations** - &#x60;rule_operations&#x60;. All rule operations. - &#x60;total_rules_operations&#x60;. Sum of all rule operations. - &#x60;batch_rules_operations&#x60;. Number of [batch rules](/specs/search#tag/Rules/operation/saveRules) operations. - &#x60;clear_rules_operations&#x60;. Number of [delete rule](/specs/search#tag/Rules/operation/deleteRule) operations. - &#x60;delete_rules_operations&#x60;. Number of [clear rules](/specs/search#tag/Rules/operation/clearRules) operations. - &#x60;get_rules_operations&#x60;. Number of [get rule](/specs/search#tag/Rules/operation/getRule) operations. - &#x60;save_rules_operations&#x60;. Number of [save rule](/specs/search#operation/getIndexUsage) operations. - &#x60;search_rules_operations&#x60;. Number of [search rules](/specs/search#tag/Rules/operation/searchRules) operations. **Total operations** - &#x60;total_recommend_requests&#x60;. Number of [Recommend requests](www.algolia.com/doc/guides/algolia-ai/recommend/) - &#x60;total_write_operations&#x60;. Number of Write operations - &#x60;total_read_operations&#x60;. Number of read operations - &#x60;total_operations&#x60;. Sum of all operations **Total Query Suggestions operations** Query Suggestions operations are a subset of &#x60;total_search_operations&#x60;. - &#x60;querysuggestions_total_search_operations&#x60;. Number of Query Suggestions search operations. - &#x60;querysuggestions_total_search_requests&#x60;. Number of Query Suggestions [search requests](support.algolia.com/hc/en-us/articles/4406981829777-How-does-Algolia-count-records-and-operations-). - &#x60;querysuggestions_total_acl_operations&#x60;. Sum of all Query Suggestions [ACL operations](#acl-operations). - &#x60;querysuggestions_total_indexing_operations&#x60;. Number of Query Suggestions [indexing operations](#indexing-operations). - &#x60;querysuggestions_total_records_operations&#x60;. Number of Query Suggestions [record operations](#record-operations). - &#x60;querysuggestions_total_synonym_operations&#x60;. Number of Query Suggestions [synonym operations](#synonym-operations). - &#x60;querysuggestions_total_rules_operations&#x60;. Number of Query Suggestions [Rule operations](#rule-operations). - &#x60;querysuggestions_total_write_operations&#x60;. Number of Query Suggestions Write operations. - &#x60;querysuggestions_total_read_operations&#x60;. Number of Query Suggestions Read operations. - &#x60;querysuggestions_total_operations&#x60;. Sum of all Query Suggestions operations. **Processing time** - &#x60;avg_processing_time&#x60;. Average processing time (in milliseconds). - &#x60;90p_processing_time&#x60;. 90th percentile of processing time (in milliseconds). - &#x60;99p_processing_time&#x60;. 99th percentile of processing time (in milliseconds). - &#x60;queries_above_last_ms_processing_time&#x60;. Number of queries that take one or more seconds to process. Indices - &#x60;records&#x60;. Number of records. - &#x60;data_size&#x60;. The size of the records (in bytes). - &#x60;file_size&#x60;. The size of the records and index metadata (in bytes). **Maximum queries per second** - &#x60;max_qps&#x60;. [Maximum queries per second](support.algolia.com/hc/en-us/articles/4406975224721) per server. - &#x60;region_max_qps&#x60;. Maximum queries per second per region. - &#x60;total_max_qps&#x60;. Maximum queries per second across all servers. **Used search capacity** The following capacities are reported in percent: - &#x60;used_search_capacity&#x60;. Maximum search capacity used per server. - &#x60;avg_used_search_capacity&#x60;. Average search capacity used per server. - &#x60;region_used_search_capacity&#x60;. Maximum search capacity used per region. - &#x60;region_avg_used_search_capacity&#x60;. Average search capacity used per region. - &#x60;total_used_search_capacity&#x60;. Maximum search capacity used for all servers. - &#x60;total_avg_used_search_capacity&#x60;. Average used search capacity for all servers. **Degraded queries** Check the impact of [degraded queries](support.algolia.com/hc/en-us/articles/4406981934481). - &#x60;degraded_queries_ssd_used_queries_impacted&#x60;. Percentage of degraded queries due to the Algolia search engine having to read from the server&#39;s SSD. - &#x60;degraded_queries_ssd_used_seconds_impacted&#x60;. Percentage of seconds affected by &#x60;ssd_used&#x60; degraded queries. - &#x60;degraded_queries_max_capacity_queries_impacted&#x60;. Percentage of degraded queries due to all search threads being used. - &#x60;degraded_queries_max_capacity_seconds_impacted&#x60;. Percentage of seconds affected by &#x60;max_capacity&#x60; degraded queries. (required)

  • start_date (String)

    Start date of the period to analyze, in &#x60;YYYY-MM-DD&#x60; format. (required)

  • end_date (String)

    End date of the period to analyze, in &#x60;YYYY-MM-DD&#x60; format. (required)

  • granularity (Granularity) (defaults to: nil)

    Granularity of the aggregated metrics. - &#x60;hourly&#x60;: the maximum time range for hourly metrics is 7 days. - &#x60;daily&#x60;: the maximum time range for daily metrics is 365 days. (default to ‘daily’)

  • request_options:

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

Returns:



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/algolia/api/usage_client.rb', line 299

def get_usage_with_http_info(statistic, start_date, end_date, granularity = nil, request_options = {})
  # verify the required parameter 'statistic' is set
  if @api_client.config.client_side_validation && statistic.nil?
    raise ArgumentError, "Parameter `statistic` is required when calling `get_usage`."
  end
  # verify the required parameter 'start_date' is set
  if @api_client.config.client_side_validation && start_date.nil?
    raise ArgumentError, "Parameter `start_date` is required when calling `get_usage`."
  end
  # verify the required parameter 'end_date' is set
  if @api_client.config.client_side_validation && end_date.nil?
    raise ArgumentError, "Parameter `end_date` is required when calling `get_usage`."
  end

  path = "/1/usage/{statistic}".sub("{" + "statistic" + "}", Transport.encode_uri(statistic.to_s))
  query_params = {}
  query_params[:startDate] = start_date
  query_params[:endDate] = end_date
  query_params[:granularity] = granularity unless granularity.nil?
  query_params = query_params.merge(request_options[:query_params]) unless request_options[:query_params].nil?
  header_params = {}
  header_params = header_params.merge(request_options[:header_params]) unless request_options[:header_params].nil?

  post_body = request_options[:debug_body]

  new_options = request_options.merge(
    :operation => :"UsageClient.get_usage",
    :header_params => header_params,
    :query_params => query_params,
    :body => post_body,
    :use_read_transporter => false
  )

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