Class: Elastic::EnterpriseSearch::AppSearch::Client
- Includes:
- Actions
- Defined in:
- lib/elastic/app-search/app_search.rb
Overview
The App Search Client Extends EnterpriseSearch client but overrides authentication to use access token.
Constant Summary collapse
- SIGNED_KEY_ALGORITHM =
'HS256'
Constants inherited from Client
Constants included from Utils
Class Method Summary collapse
-
.create_signed_search_key(api_key, api_key_name, options = {}) ⇒ String
Build a JWT for authentication.
Instance Method Summary collapse
- #date_to_rfc3339(date) ⇒ Object
- #http_auth ⇒ Object
- #http_auth=(api_key) ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
Create a new Elastic::EnterpriseSearch::AppSearch::Client client.
Methods included from Actions
#adaptive_relevance_settings, #adaptive_relevance_suggestions, #add_meta_engine_source, #api_key, #api_logs, #count_analytics, #crawler_active_crawl_request, #crawler_crawl_request, #crawler_crawl_schedule, #crawler_domain, #crawler_domain_validation_result, #crawler_metrics, #crawler_overview, #crawler_process_crawl, #crawler_process_crawl_denied_urls, #crawler_url_extraction_result, #crawler_url_tracing_result, #crawler_url_validation_result, #crawler_user_agent, #create_api_key, #create_crawler_crawl_request, #create_crawler_crawl_rule, #create_crawler_domain, #create_crawler_entry_point, #create_crawler_process_crawl, #create_crawler_sitemap, #create_curation, #create_engine, #create_synonym_set, #curation, #delete_active_crawl_request, #delete_api_key, #delete_crawler_active_crawl_request, #delete_crawler_crawl_rule, #delete_crawler_crawl_schedule, #delete_crawler_domain, #delete_crawler_entry_point, #delete_crawler_sitemap, #delete_curation, #delete_documents, #delete_engine, #delete_meta_engine_source, #delete_synonym_set, #denied_urls, #documents, #engine, #index_documents, #list_adaptive_relevance_suggestions, #list_api_keys, #list_crawler_crawl_requests, #list_crawler_domains, #list_crawler_process_crawls, #list_curations, #list_documents, #list_engines, #list_synonym_sets, #log_clickthrough, #multi_search, #put_adaptive_relevance_settings, #put_adaptive_relevance_suggestions, #put_api_key, #put_crawler_crawl_rule, #put_crawler_crawl_schedule, #put_crawler_domain, #put_crawler_entry_point, #put_crawler_sitemap, #put_curation, #put_documents, #put_schema, #put_search_settings, #put_synonym_set, #query_suggestion, #refresh_adaptive_relevance_update_process, #reset_search_settings, #schema, #search, #search_es_search, #search_explain, #search_settings, #synonym_set, #top_clicks_analytics, #top_queries_analytics
Methods inherited from Client
#adapter, #app_search, #host, #log, #logger, #open_timeout, #overall_timeout, #trace, #tracer, #transport, #workplace_search
Methods included from Utils
#stringify_keys, symbolize_keys
Methods included from Elastic::EnterpriseSearch::Actions
#health, #put_read_only, #read_only, #search_engines, #stats, #version
Methods included from Request
#basic_auth_header, #delete, #get, #post, #put, #request, #setup_authentication_header
Constructor Details
#initialize(options = {}) ⇒ Client
Create a new Elastic::EnterpriseSearch::AppSearch::Client client
38 39 40 |
# File 'lib/elastic/app-search/app_search.rb', line 38 def initialize( = {}) super() end |
Class Method Details
.create_signed_search_key(api_key, api_key_name, options = {}) ⇒ String
Build a JWT for authentication
52 53 54 55 |
# File 'lib/elastic/app-search/app_search.rb', line 52 def create_signed_search_key(api_key, api_key_name, = {}) payload = Elastic::EnterpriseSearch::Utils.symbolize_keys().merge(api_key_name: api_key_name) JWT.encode(payload, api_key, SIGNED_KEY_ALGORITHM) end |
Instance Method Details
#date_to_rfc3339(date) ⇒ Object
66 67 68 |
# File 'lib/elastic/app-search/app_search.rb', line 66 def date_to_rfc3339(date) DateTime.parse(date.to_s).rfc3339 end |
#http_auth ⇒ Object
58 59 60 |
# File 'lib/elastic/app-search/app_search.rb', line 58 def http_auth @options[:http_auth] end |
#http_auth=(api_key) ⇒ Object
62 63 64 |
# File 'lib/elastic/app-search/app_search.rb', line 62 def http_auth=(api_key) @options[:http_auth] = api_key end |