Class: Elastic::AppSearch::Client

Inherits:
Object
  • Object
show all
Includes:
Analytics, Click, Credentials, Curations, Documents, Engines, Logs, MetaEngines, QuerySuggestion, Schema, Search, SearchSettings, SignedSearchOptions, Synonyms, Request
Defined in:
lib/elastic/app-search/client.rb,
lib/elastic/app-search/client/logs.rb,
lib/elastic/app-search/client/click.rb,
lib/elastic/app-search/client/schema.rb,
lib/elastic/app-search/client/search.rb,
lib/elastic/app-search/client/engines.rb,
lib/elastic/app-search/client/synonyms.rb,
lib/elastic/app-search/client/analytics.rb,
lib/elastic/app-search/client/curations.rb,
lib/elastic/app-search/client/documents.rb,
lib/elastic/app-search/client/credentials.rb,
lib/elastic/app-search/client/meta_engines.rb,
lib/elastic/app-search/client/search_settings.rb,
lib/elastic/app-search/client/query_suggestion.rb

Overview

API client for the Elastic App Search API.

Defined Under Namespace

Modules: Analytics, Click, Credentials, Curations, Documents, Engines, Logs, MetaEngines, QuerySuggestion, Schema, Search, SearchSettings, SignedSearchOptions, Synonyms

Constant Summary collapse

DEFAULT_TIMEOUT =
15

Constants included from SignedSearchOptions

SignedSearchOptions::ALGORITHM

Constants included from MetaEngines

MetaEngines::ENGINE_TYPE_META

Instance Attribute Summary collapse

Attributes included from Request

#last_request

Instance Method Summary collapse

Methods included from QuerySuggestion

#query_suggestion

Methods included from Synonyms

#create_synonym_set, #destroy_synonym_set, #get_synonym_set, #list_synonym_sets, #update_synonym_set

Methods included from SignedSearchOptions

included

Methods included from SearchSettings

#reset_settings, #show_settings, #update_settings

Methods included from Search

#multi_search, #search

Methods included from Schema

#get_schema, #update_schema

Methods included from Logs

#get_api_logs

Methods included from MetaEngines

#add_meta_engine_sources, #create_meta_engine, #delete_meta_engine_sources

Methods included from Engines

#create_engine, #destroy_engine, #get_engine, #list_engines

Methods included from Documents

#destroy_documents, #get_documents, #index_document, #index_documents, #list_documents, #update_documents

Methods included from Curations

#create_curation, #destroy_curation, #get_curation, #list_curations, #update_curation

Methods included from Credentials

#create_credential, #destroy_credential, #get_credential, #list_credentials, #update_credential

Methods included from Click

#log_click_through

Methods included from Analytics

#get_count_analytics, #get_top_clicks_analytics, #get_top_queries_analytics

Methods included from Request

#delete, #get, #patch, #post, #put, #request

Constructor Details

#initialize(options = {}) ⇒ Client

Create a new Elastic::AppSearch::Client client

Parameters:

  • options (Hash) (defaults to: {})

    a hash of configuration options that will override what is set on the Elastic::AppSearch class.

Options Hash (options):

  • :account_host_key (String)

    or :host_identifier is your Host Identifier to use with this client.

  • :api_key (String)

    can be any of your API Keys. Each has a different scope, so ensure you are using the correct key.

  • :overall_timeout (Numeric)

    overall timeout for requests in seconds (default: 15s)

  • :open_timeout (Numeric)

    the number of seconds Net::HTTP (default: 15s) will wait while opening a connection before raising a Timeout::Error



38
39
40
41
42
43
# File 'lib/elastic/app-search/client.rb', line 38

def initialize(options = {})
  @api_endpoint = options.fetch(:api_endpoint) { "https://#{options.fetch(:account_host_key) { options.fetch(:host_identifier) }}.api.swiftype.com/api/as/v1/" }
  @api_key = options.fetch(:api_key)
  @open_timeout = options.fetch(:open_timeout, DEFAULT_TIMEOUT).to_f
  @overall_timeout = options.fetch(:overall_timeout, DEFAULT_TIMEOUT).to_f
end

Instance Attribute Details

#api_endpointObject (readonly)

Returns the value of attribute api_endpoint.



28
29
30
# File 'lib/elastic/app-search/client.rb', line 28

def api_endpoint
  @api_endpoint
end

#api_keyObject (readonly)

Returns the value of attribute api_key.



28
29
30
# File 'lib/elastic/app-search/client.rb', line 28

def api_key
  @api_key
end

#open_timeoutObject (readonly)

Returns the value of attribute open_timeout.



28
29
30
# File 'lib/elastic/app-search/client.rb', line 28

def open_timeout
  @open_timeout
end

#overall_timeoutObject (readonly)

Returns the value of attribute overall_timeout.



28
29
30
# File 'lib/elastic/app-search/client.rb', line 28

def overall_timeout
  @overall_timeout
end