Official Ruby client for Elastic Enterprise Search, App Search, and Workplace Search
APACHE-2.0 License
Bot releases are visible (Hide)
Published by picandocodigo over 1 year ago
boost
to boosts
.Published by picandocodigo almost 2 years ago
Published by picandocodigo almost 2 years ago
Updates dependency on elastic-transport
. With the latest release of elastic-transport
- v8.1.0
- this gem now supports Faraday v2. When you upgrade your gems, 8.1.0
will be installed. This supports both Faraday v1 and Faraday v2. The main change on dependencies when using Faraday v2 is all adapters, except for the default net_http
one, have been moved out of Faraday into separate gems. This means if you're not using the default adapter and you migrate to Faraday v2, you'll need to add the adapter gems to your Gemfile.
These are the gems required for the different adapters with Faraday 2, instead of the libraries on which they were based:
# HTTPCLient
gem 'faraday-httpclient'
# NetHTTPPersistent
gem 'faraday-net_http_persistent'
# Patron
gem 'faraday-patron'
# Typhoeus
gem 'faraday-typhoeus'
Things should work fine if you migrate to Faraday 2 as long as you include the adapter (unless you're using the default one net-http
), but worst case scenario, you can always lock the version of Faraday in your project to 1.x:
gem 'faraday', '~> 1'
Troubleshooting
If you see a message like:
:adapter is not registered on Faraday::Adapter (Faraday::Error)
Then you probably need to include the adapter library in your gemfile and require it.
Please submit an issue if you encounter any problems.
precision_enabled
(Boolean) to put_search_settings
. See https://www.elastic.co/guide/en/app-search/current/search-settings.html#search-settings-update[here] for more information.search_es_search
and search_explain
changed the path to api/as/v1
instead of v0
and are now GA with version 8.5
of the stack.Published by picandocodigo about 2 years ago
CAUTION
The Elasticsearch search API for App Search is a beta feature. Beta features are subject to change and are not covered by the support SLA of generally available (GA) features. Elastic plans to promote this feature to GA in a future release.
The Elasticsearch Search API search_es_search
has been updated to be more consistent with the Elasticsearch _search
API.
In the previous version, a request
object was required in the request:
# DEPRECATED - This worked for 8.3 but has been updated in 8.4:
es_request = { body: { query: { bool: { must: { term: { title: 'test' } } } } } }
client.search_es_search(engine_name, body: { request: es_request })
This has been simplified to:
es_request = { query: { bool: { must: { term: { title: 'test' } } } } }
client.search_es_search(engine_name, body: es_request)
Published by picandocodigo over 2 years ago
New API: search_engines
- Retrieve information about search engines
Published by picandocodigo over 2 years ago
Published by picandocodigo over 2 years ago
Published by picandocodigo over 2 years ago
Published by picandocodigo over 2 years ago
es_request = { body: { query: { bool: { must: { term: { title: 'test' } } } } } }
client.search_es_search(engine_name, body: { request: es_request })
response = client.search_explain(engine_name, body: { query: 'test' })
response.body['query_string']
# => "GET enterprise-search-engine-app-search-explain/_search"
Published by picandocodigo over 2 years ago
Published by picandocodigo over 2 years ago
First release in the 8.x
branch of the client.
GET
or DELETE
requests to not have a body
. Requests with PUT
and POST
now expect most parameters to be in the request body. Parameters that were available as both arguments and in the body are now just in the body.Requests now return an Elastic::API::Response
object. This behaves exactly the same as the previous response (Elastic::Transport::Transport::Response
) but expands its functionality. With the previous response object, the body of the response had to be accessed calling the body
method on the response. This new object behaves like the response.body Hash object, except when the status
or headers
are sent to it. This makes it easier to access the response data. Example:
client = Elastic::EnterpriseSearch::Client.new(
host: 'http://localhost:3002',
http_auth: {user: 'elastic', password: 'changeme'}
)
response = client.health
response.class
# => Elastic::API::Response
response['version']['number']
# => "8.1.4"
response.body['version']['number']
# => "8.1.4"
response.status
# => 200
response.headers
# =>
{"date"=>"Tue, 10 May 2022 09:01:10 GMT",
"content-type"=>"application/json;charset=utf-8",
"etag"=>"W/\"etag--gzip\"",
"cache-control"=>"max-age=0, private, must-revalidate",
"x-request-id"=>"id",
"x-runtime"=>"0.023468",
"vary"=>"Accept-Encoding, User-Agent",
"content-length"=>"755",
"server"=>"Jetty(9.4.43.v20210629)"}
date
parameters for filters. This API requires a nested date object under filters
(now passed in via the body) containing from
and to
keys formatted in accordance with RFC3339. The App Search client provides the helper function date_to_rfc3339
which receives a date String and converts it to the right format.v0
to v1
. create_crawler_crawl_rule
body is a required parameter (order
, policy
, rule
, pattern
). create_crawler_entry_point
body is required (for value
). create_crawler_sitemap
body is required (for url
). put_crawler_crawl_rule
body is required (order
, policy
, rule
, pattern
). put_crawler_crawl_schedule
body is required (frequency
, unit
). put_crawler_entry_point
body is required (for value
). put_crawler_sitemap
body is required (url
).create_curation
and put_curation
must be passed in inside the body parameter now.create_engine
removes the name
parameter. It must be passed in inside the body parameter now.log_clickthrough
now requires body
, the parameter query
and document_id
are required.search
, query can no longer be sent as an argument. The method will raise ArgumentError
if no body is sent, since query
is a required parameter in the body.body
has been removed since it's not used: delete_engine
, engine
, list_engines
, curation
, delete_curation
, schema
, api_key
, delete_api_key
, list_api_keys
, delete_synonym_set
, list_synonym_set
, synonym_set
, list_documents
, reset_search_settings
, search_settings
, crawler_active_crawl_request
, crawler_crawl_request
, crawler_crawl_schedule
, crawler_domain
, crawler_metrics
, crawler_overview
, crawler_process_crawl
, crawler_process_crawl_denied_urls
, crawler_user_agent
, delete_crawler_active_crawl_request
, delete_crawler_crawl_rule
, delete_crawler_crawl_schedule
, delete_crawler_domain
, delete_crawler_entry_point
, delete_crawler_sitemap
, list_crawler_crawl_requests
, list_crawler_process_crawls
.list_crawler_domain
: Lists crawler domains given an engine.adaptive_relevance_suggestions
- Retrieves adaptive relevance for a single query.list_adaptive_relevance_suggestions
- List the adaptive relevance suggestions for a given engine.put_adaptive_relevance_suggestions
- Update adaptive relevance.adaptive_relevance_settings
- Retrieve adaptive relevance settings.put_adaptive_relevance_settings
- Update adaptive relevance settings.refresh_adaptive_relevance_update_process
- Update suggestions process refresh.put_read_only
body is now required with the enabled object: {enabled: true|false}
.body
has been removed since it's not used: health
, read_only
, stats
, version
.Permissions APIs have been removed: add_user_permissions
, list_permissions
, put_user_permissions
, remove_user_permissions
, user_permissions
.
current_user
removed get_token
parameter.
Analytics: create_analytics_events
will raise ArgumentError if body is missing (Required: type, query_id, page, content_source_id, document_id, rank)
Content Sources: create_content_source
will raise ArgumentError if body is missing (Required: name). name
cannot be passed in as a parameter anymore, needs to be in the body. put_content_source
will raise ArgumentError if body is missing (Required: name, is_searchable). put_content_source_icons
will raise ArgumentError if body is missing.
External Identities: create_external_identity
will raise ArgumentError if body is missing (Required: external_user_id, external_user_properties, permissions). Body parameters have changed:
body = {
external_user_id: external_user_id,
permissions: [],
external_user_properties: [
'attribute_name' => '_elasticsearch_username',
'attribute_value' => 'fernando'
]
}
client.create_external_identity(content_source_id, body: body)
In delete_external_identity
, external_identity
and put_external_identity
the required parameter changed from user
to external_user_id
.
See https://www.elastic.co/guide/en/workplace-search/current/workplace-search-external-identities-api.html
Search: Parameters need to be passed in via body to search
. It will raise ArgumentError if body is missing.
Documents: delete_documents
will raise ArgumentError if body is missing (Required document_ids).
Sync Jobs: command_sync_jobs
will raise ArgumentError if body is missing.
Synonyms: create_batch_synonym_sets
, put_synonym_set
will raise ArgumentError if body is missing.
APIs where body
has been removed since it's not used: auto_query_refinement_details
, content_source
, current_user
, delete_content_source
, delete_external_identity
, delete_synonym_set
, document
, external_identity
, list_content_sources
, list_external_identities
, put_triggers_blocklist
, synonym_set
, triggers_blocklist
.
list_documents
: Lists documents from a custom content source.Published by picandocodigo over 2 years ago
This is a pre-release for the upcoming 8.x
versions of the client.
Full release notes will be released with 8.0.0 GA.
Published by picandocodigo over 2 years ago
7.x
branch.Published by picandocodigo almost 3 years ago
adaptive_relevance_settings
, adaptive_relevance_suggestions
, list adaptive_relevance_suggestions
, put_adaptive_relevance_settings
, put_adaptive_relevance_suggestions
.list_crawler_domains
- Returns a list of crawler domainslist_documents
- List documents from a custom content sourcePublished by picandocodigo almost 3 years ago
Updates dependency on elasticsearch-transport
to be more open. At least 7.11 is required, but this way it can be used with different versions of the elasticsearch
gem (bigger than or equal to 7.11
) in the same project, without a conflict in elasticsearch-transport
. When instantiating transport, we now check if version is < 7.14
so we use the right class.
Published by picandocodigo almost 3 years ago
Updates dependency on elasticsearch-transport
to be more open. At least 7.11 is required, but this way it can be used with different versions of the elasticsearch
gem (bigger than or equal to 7.11
) in the same project, without a conflict in elasticsearch-transport
. When instantiating transport, we now check if version is < 7.14
so we use the right class.
Published by picandocodigo about 3 years ago
The test suite was migrated to full integration testing in Jenkins. We were using VCR for testing the API, but now we're running the API tests against an instance of Elastic Enterprise Search.
Some APIs that used to work with GET
query parameters in App Search are now POST
and the parameters being sent with the body. We'll use the body from 7.15
, but we'll keep supporting arguments parameters in 7.x for backwards compatibility. Some parameters previously required through the generated code don't throw an exception anymore and the error is delegated to server. As mentioned, these should go through the body instead of part of the query parameters, but we still support sending them as query parameters in 7.x
to keep backwards compatibility.
⚠️ The Elastic Enterprise Search web crawler API is a beta feature.
Beta features are subject to change and are not covered by the support SLA of general release (GA) features.
Elastic plans to promote this feature to GA in a future release.
crawler_active_crawl_request
, crawler_crawl_request
, crawler_crawl_schedule
, crawler_domain
, crawler_domain_validation_result
, crawler_metrics
, crawler_overview
, crawler_process_crawl_denied_urls
, crawler_process_crawl
, crawler_url_extraction_result
, crawler_url_tracing_result
, crawler_url_validation_result
, crawler_user_agent
, create_crawler_crawl_request
, create_crawler_crawl_rule
, create_crawler_domain
, create_crawler_entry_point
, create_crawler_process_crawl
, create_crawler_sitemap
, delete_active_crawl_request
, delete_crawler_active_crawl_request
, delete_crawler_crawl_rule
, delete_crawler_crawl_schedule
, delete_crawler_domain
, delete_crawler_entry_point
, delete_crawler_sitemap
, list_crawler_crawl_requests
, list_crawler_process_crawls
, put_crawler_crawl_rule
, put_crawler_crawl_schedule
, put_crawler_domain
, put_crawler_entry_point
, put_crawler_sitemap
.
Refer to App Search API for more information and examples.
auto_query_refinement_details
, triggers_blocklist
and put_triggers_blocklist
. See Workplace Search API for more information and examples.