elastic-enterprise-search 7.16.0 → 7.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ci/test-matrix.yml +2 -2
- data/.github/workflows/compatibility.yml +2 -2
- data/.github/workflows/testing.yml +1 -1
- data/CHANGELOG +1 -0
- data/CODE_OF_CONDUCT +1 -0
- data/CONTRIBUTING.md +37 -0
- data/NOTICE +2 -0
- data/README.md +25 -29
- data/docs/guide/app-search-api.asciidoc +0 -26
- data/docs/guide/overview.asciidoc +9 -1
- data/docs/guide/release_notes/717.asciidoc +21 -0
- data/docs/guide/release_notes/index.asciidoc +2 -0
- data/lib/elastic/app-search/api/crawler_domain_validation_result.rb +1 -1
- data/lib/elastic/app-search/api/crawler_url_tracing_result.rb +2 -1
- data/lib/elastic/app-search/api/crawler_url_validation_result.rb +2 -1
- data/lib/elastic/app-search/api/create_crawler_crawl_rule.rb +0 -1
- data/lib/elastic/app-search/api/create_crawler_entry_point.rb +0 -1
- data/lib/elastic/app-search/api/create_crawler_sitemap.rb +0 -1
- data/lib/elastic/app-search/api/create_curation.rb +0 -1
- data/lib/elastic/app-search/api/log_clickthrough.rb +5 -5
- data/lib/elastic/app-search/api/put_crawler_crawl_rule.rb +0 -1
- data/lib/elastic/app-search/api/put_crawler_entry_point.rb +0 -1
- data/lib/elastic/app-search/api/put_crawler_sitemap.rb +0 -1
- data/lib/elastic/app-search/api/put_curation.rb +0 -1
- data/lib/elastic/enterprise-search/client.rb +6 -0
- data/lib/elastic/enterprise-search/request.rb +1 -1
- data/lib/elastic/enterprise-search/version.rb +1 -1
- data/spec/app-search/client_spec.rb +29 -0
- data/spec/enterprise-search/client_spec.rb +29 -0
- data/spec/fixtures/vcr/workplace_search/create_analytics_event.yml +1 -1
- data/spec/fixtures/vcr/workplace_search/oauth_request_token.yml +1 -1
- data/spec/fixtures/vcr/workplace_search/search_request.yml +1 -1
- data/spec/integration/app-search/crawler_domain_spec.rb +1 -6
- data/spec/workplace-search/client_spec.rb +29 -0
- metadata +7 -10
- data/lib/elastic/app-search/api/adaptive_relevance_settings.rb +0 -51
- data/lib/elastic/app-search/api/adaptive_relevance_suggestions.rb +0 -56
- data/lib/elastic/app-search/api/list_adaptive_relevance_suggestions.rb +0 -53
- data/lib/elastic/app-search/api/list_crawler_domains.rb +0 -51
- data/lib/elastic/app-search/api/put_adaptive_relevance_settings.rb +0 -52
- data/lib/elastic/app-search/api/put_adaptive_relevance_suggestions.rb +0 -51
- data/spec/integration/app-search/adaptive_relevance_spec.rb +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20d5dc58d956de95e2aa7d0723236fddf174fdbf17bb59685609a3cbeb3115cf
|
4
|
+
data.tar.gz: f343bdbeb2448f5a77750a1bf1f28e54152e56662ce490633e5bd49232695230
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7dc1bce350ac51b2061bd1d85037b51d884a31b558aa8d4164a98d4eb18d7d403558029719037f824358788466ad14a050d2c799532fc7505f2d64dc681fb4c
|
7
|
+
data.tar.gz: d5c0604ace9a80dd05c3ec1f0b04d6ef0f48aebda33727632ce01d1a3ce7b217cec72d044b9dd3344ba7f160d4350991f4c61b29b875c0c6c3feff0394bc5048
|
data/.ci/test-matrix.yml
CHANGED
@@ -7,13 +7,13 @@ jobs:
|
|
7
7
|
ES_VERSION: ${{ matrix.es_version }}
|
8
8
|
strategy:
|
9
9
|
matrix:
|
10
|
-
es_version: [ 7.11, 7.12, 7.13, 7.14, 7.15 ]
|
10
|
+
es_version: [ 7.11, 7.12, 7.13, 7.14, 7.15, 7.16 ]
|
11
11
|
runs-on: ubuntu-latest
|
12
12
|
steps:
|
13
13
|
- uses: actions/checkout@v2
|
14
14
|
- uses: ruby/setup-ruby@v1
|
15
15
|
with:
|
16
|
-
ruby-version: 3.
|
16
|
+
ruby-version: 3.1
|
17
17
|
- name: Build Gemfile with Elasticsearch gem
|
18
18
|
run: |
|
19
19
|
ruby -v
|
data/CHANGELOG
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
See https://www.elastic.co/guide/en/enterprise-search-clients/ruby/current/release_notes.html
|
data/CODE_OF_CONDUCT
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
See: https://www.elastic.co/community/codeofconduct
|
data/CONTRIBUTING.md
CHANGED
@@ -1,5 +1,42 @@
|
|
1
1
|
# Contributing to enterprise-search-ruby
|
2
2
|
|
3
|
+
## Run Stack locally
|
4
|
+
|
5
|
+
A rake task is included to run the Elastic Enterprise Search stack locally via Docker:
|
6
|
+
|
7
|
+
```
|
8
|
+
$ rake stack[7.10.0]
|
9
|
+
```
|
10
|
+
|
11
|
+
This will run Elastic Enterprise Search in http://localhost:3002
|
12
|
+
- Username: `enterprise_search`
|
13
|
+
- Password: `changeme`
|
14
|
+
|
15
|
+
The version of the Elastic Enterprise Search Stack to use should be the same as tags of `https://www.docker.elastic.co/r/enterprise-search`. You can also use SNAPSHOT builds such as `8.0.0-SNAPSHOT`, `7.11-SNAPSHOT`, etc.
|
16
|
+
|
17
|
+
## Running Tests
|
18
|
+
|
19
|
+
Unit tests for the clients:
|
20
|
+
|
21
|
+
```
|
22
|
+
$ rake spec:client
|
23
|
+
```
|
24
|
+
|
25
|
+
Integration tests: you need to have an instance of Enterprise Search running either locally or remotely, and specify the host and credentials in environment variables (see below for a complete dockerized setup). If you're using the included rake task `rake stack[:version]`, you can run the integration tests with the following command:
|
26
|
+
|
27
|
+
```
|
28
|
+
$ ELASTIC_ENTERPRISE_HOST='http://localhost:3002' \
|
29
|
+
ELASTIC_ENTERPRISE_USER='elastic' \
|
30
|
+
ELASTIC_ENTERPRISE_PASSWORD='changeme' \
|
31
|
+
rake spec:integration
|
32
|
+
```
|
33
|
+
|
34
|
+
Run integration tests completely within containers, the way we run them on our CI:
|
35
|
+
```
|
36
|
+
RUNSCRIPTS=enterprise-search STACK_VERSION=7.10.0 ./.ci/run-tests
|
37
|
+
```
|
38
|
+
|
39
|
+
|
3
40
|
## Contributing Code Changes
|
4
41
|
|
5
42
|
1. Please make sure you have signed the [Contributor License
|
data/NOTICE
ADDED
data/README.md
CHANGED
@@ -6,48 +6,44 @@
|
|
6
6
|
|
7
7
|
Official Ruby API client for [Elastic Enterprise Search](https://www.elastic.co/enterprise-search). Use this gem to integrate App Search and Workplace Search into your Ruby code.
|
8
8
|
|
9
|
-
##
|
10
|
-
|
11
|
-
[See the documentation](https://www.elastic.co/guide/en/enterprise-search-clients/ruby/current/index.html) for compatibility info, configuring, and an API reference.
|
12
|
-
|
13
|
-
## Development
|
14
|
-
|
15
|
-
### Run Stack locally
|
9
|
+
## Installation
|
16
10
|
|
17
|
-
|
11
|
+
Install the `elastic-enterprise-search` gem from [Rubygems](https://rubygems.org/gems/elastic-enterprise-search):
|
18
12
|
|
19
13
|
```
|
20
|
-
$
|
14
|
+
$ gem install elastic-enterprise-search
|
21
15
|
```
|
22
16
|
|
23
|
-
|
24
|
-
- Username: `enterprise_search`
|
25
|
-
- Password: `changeme`
|
17
|
+
Or add it to your project's Gemfile:
|
26
18
|
|
27
|
-
|
19
|
+
```ruby
|
20
|
+
gem 'elastic-enterprise-search', 'VERSION'
|
21
|
+
```
|
28
22
|
|
29
|
-
|
23
|
+
The Enterprise Search client is implemented with [`elastic-transport`](https://github.com/elastic/elastic-transport-ruby/) as the HTTP layer, which uses [Faraday](https://rubygems.org/gems/faraday). Faraday supports several [adapters](https://lostisland.github.io/faraday/adapters/) and will use `Net::HTTP` by default. For optimal performance with the Enterprise Search API, we suggest using an HTTP library which supports persistent ("keep-alive") connections. For the standard Ruby implementation, this could be https://github.com/drbrain/net-http-persistent[Net::HTTP::Persistent], [patron](https://github.com/toland/patron) or [Typhoeus](https://github.com/typhoeus/typhoeus). For JRuby, [Manticore](https://github.com/cheald/manticore) is a great option as well. Require the library for the adapter in your code and then pass in the `:adapter` parameter to the client when you initialize it:
|
30
24
|
|
31
|
-
|
25
|
+
```ruby
|
26
|
+
require 'elastic-enterprise-search'
|
27
|
+
require 'faraday/net_http_persistent'
|
32
28
|
|
29
|
+
client = Elastic::EnterpriseSearch::Client.new(adapter: :net_http_persistent)
|
33
30
|
```
|
34
|
-
|
35
|
-
```
|
31
|
+
If an adapter is not specified, the client will try to auto-detect available libraries and use the best available HTTP client.
|
36
32
|
|
37
|
-
|
33
|
+
## Documentation
|
38
34
|
|
39
|
-
|
40
|
-
$ ELASTIC_ENTERPRISE_HOST='http://localhost:3002' \
|
41
|
-
ELASTIC_ENTERPRISE_USER='elastic' \
|
42
|
-
ELASTIC_ENTERPRISE_PASSWORD='changeme' \
|
43
|
-
rake spec:integration
|
44
|
-
```
|
35
|
+
[See the documentation](https://www.elastic.co/guide/en/enterprise-search-clients/ruby/current/index.html) for usage, code examples, configuring the client, and an API reference.
|
45
36
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
37
|
+
See code examples of usage for the [Enterprise Search](https://www.elastic.co/guide/en/enterprise-search-clients/ruby/current/enterprise-search-api.html), [App Search](https://www.elastic.co/guide/en/enterprise-search-clients/ruby/current/app-search-api.html) and [Workplace Search](https://www.elastic.co/guide/en/enterprise-search-clients/ruby/current/workplace-search-api.html) APIs.
|
38
|
+
|
39
|
+
## Compatibility
|
40
|
+
|
41
|
+
We follow Ruby’s own maintenance policy and officially support all currently maintained versions per [Ruby Maintenance Branches](https://www.ruby-lang.org/en/downloads/branches/).
|
42
|
+
|
43
|
+
## Development
|
44
|
+
|
45
|
+
See [CONTRIBUTING](https://github.com/elastic/enterprise-search-ruby/blob/main/CONTRIBUTING.md).
|
50
46
|
|
51
47
|
## License
|
52
48
|
|
53
|
-
Apache
|
49
|
+
This software is licensed under the [Apache 2 license](./LICENSE). See [NOTICE](./NOTICE).
|
@@ -196,9 +196,6 @@ client.create_crawler_domain(engine_name, body: body)
|
|
196
196
|
# Get crawler domain information
|
197
197
|
client.crawler_domain(engine_name, domain_id: domain_id)
|
198
198
|
|
199
|
-
# List crawler domains
|
200
|
-
client.list_crawler_domains(engine_name)
|
201
|
-
|
202
199
|
# Update a crawler domain
|
203
200
|
body = { name: 'https://www.wikipedia.org' }
|
204
201
|
client.put_crawler_domain(engine_name, domain_id: domain_id, domain: body)
|
@@ -304,29 +301,6 @@ client.crawler_process_crawl_denied_urls(engine_name, process_crawl_id: id)
|
|
304
301
|
# Cancel an active crawl request, stopping a running crawl if needed.
|
305
302
|
client.delete_crawler_active_crawl_request(engine_name)
|
306
303
|
----------------------------
|
307
|
-
=== Adaptive Relevance
|
308
|
-
|
309
|
-
|
310
|
-
The adaptive relevance 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. The adaptive relevance API is not available at all Elastic subscription levels. Refer to the Elastic subscriptions pages for https://www.elastic.co/subscriptions/cloud[Elastic Cloud] and https://www.elastic.co/subscriptions[self-managed] deployments.
|
311
|
-
|
312
|
-
[source,rb]
|
313
|
-
----------------------------
|
314
|
-
# Retrieve adaptive relevance settings
|
315
|
-
client.adaptive_relevance_settings(engine_name)
|
316
|
-
|
317
|
-
# Update adaptive relevance settings for an engine
|
318
|
-
body = { curation: { enabled: true } }
|
319
|
-
client.put_adaptive_relevance_settings(engine_name, body: body)
|
320
|
-
|
321
|
-
# List suggestions
|
322
|
-
client.list_adaptive_relevance_suggestions(engine_name)
|
323
|
-
|
324
|
-
# Update adaptive relevance
|
325
|
-
client.put_adaptive_relevance_suggestions(engine_name, body: body)
|
326
|
-
|
327
|
-
# Retrive adaptive relevance
|
328
|
-
client.adaptive_relevance_suggestions(engine_name, search_suggestion_query: 'suggestion')
|
329
|
-
----------------------------
|
330
304
|
|
331
305
|
=== Other API Endpoints
|
332
306
|
|
@@ -14,7 +14,15 @@ For **Elastic Enterprise Search 7.0** and later, use the major version 7 (`7.x.y
|
|
14
14
|
|
15
15
|
[discrete]
|
16
16
|
=== HTTP Library
|
17
|
-
This library uses https://github.com/elastic/
|
17
|
+
This library uses https://github.com/elastic/elastic-transport-ruby[elastic-transport], the low-level Ruby client for connecting to an Elastic clusters - also used in the official https://github.com/elastic/elasticsearch-ruby[Elasticsearch Ruby Client]. It uses https://rubygems.org/gems/faraday[Faraday], which supports several https://lostisland.github.io/faraday/adapters/[adapters] and will use `Net::HTTP` by default. For optimal performance with the Enterprise Search API, we suggest using an HTTP library which supports persistent ("keep-alive") connections. For the standard Ruby implementation, this could be https://github.com/drbrain/net-http-persistent[Net::HTTP::Persistent], https://github.com/toland/patron[patron] or https://github.com/typhoeus/typhoeus[Typhoeus]. For JRuby, https://github.com/cheald/manticore[Manticore] is a great option as well. Require the library for the adapter in your code and then pass in the `:adapter` parameter to the client when you initialize it:
|
18
|
+
|
19
|
+
[source,ruby]
|
20
|
+
---------------------------------------------------
|
21
|
+
require 'elastic-enterprise-search'
|
22
|
+
require 'faraday/net_http_persistent'
|
23
|
+
|
24
|
+
client = Elastic::EnterpriseSearch::Client.new(adapter: :net_http_persistent)
|
25
|
+
---------------------------------------------------
|
18
26
|
|
19
27
|
All requests, if successful, will return an `Elasticsearch::Transport::Transport::Response` instance. You can access the response `body`, `headers` and `status`.
|
20
28
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
[[release_notes_717]]
|
2
|
+
=== 7.17 Release notes
|
3
|
+
|
4
|
+
[discrete]
|
5
|
+
[[release_notes_7171]]
|
6
|
+
=== 7.17.1 Release notes
|
7
|
+
|
8
|
+
- Updates in Documentation: CHANGELOG, CODE_OF_CONDUCT, CONTRIBUTING, NOTICE, README
|
9
|
+
- Adds the option to specify an adapter for Faraday when initializing a client. See https://github.com/elastic/enterprise-search-ruby/blob/main/README.md#elastic-enterprise-search-client[README]
|
10
|
+
- Fixes typo in meta data for CLIENT_NAME.
|
11
|
+
|
12
|
+
[discrete]
|
13
|
+
[[release_notes_7170]]
|
14
|
+
=== 7.17.0 Release notes
|
15
|
+
|
16
|
+
[discrete]
|
17
|
+
==== General
|
18
|
+
|
19
|
+
- Tested with Elastic Enterprise Search API version 7.17.0.
|
20
|
+
- Last release in the `7.x` branch.
|
21
|
+
- Tested with Ruby 2.6, 2.7, 3.0, 3.1
|
@@ -5,6 +5,7 @@
|
|
5
5
|
[discrete]
|
6
6
|
=== 7.x
|
7
7
|
|
8
|
+
* <<release_notes_717, 7.17.0 Release Notes>>
|
8
9
|
* <<release_notes_716, 7.16.0 Release Notes>>
|
9
10
|
* <<release_notes_715, 7.15.0 Release Notes>>
|
10
11
|
* <<release_notes_714, 7.14.0 Release Notes>>
|
@@ -13,6 +14,7 @@
|
|
13
14
|
* <<release_notes_711, 7.11.0 Release Notes>>
|
14
15
|
* <<release_notes_710, 7.10.0.beta.1 Release Notes>>
|
15
16
|
|
17
|
+
include::717.asciidoc[]
|
16
18
|
include::716.asciidoc[]
|
17
19
|
include::715.asciidoc[]
|
18
20
|
include::714.asciidoc[]
|
@@ -28,7 +28,7 @@ module Elastic
|
|
28
28
|
# @option arguments [String] :body
|
29
29
|
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
30
30
|
#
|
31
|
-
# @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html
|
31
|
+
# @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html
|
32
32
|
#
|
33
33
|
def crawler_domain_validation_result(arguments = {})
|
34
34
|
body = arguments.delete(:body) || {}
|
@@ -27,9 +27,10 @@ module Elastic
|
|
27
27
|
# @param engine_name [String] Name of the engine (*Required*)
|
28
28
|
# @param arguments [Hash] endpoint arguments
|
29
29
|
# @option arguments [String] :body
|
30
|
+
# @option arguments [String] :url (*Required*)
|
30
31
|
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
31
32
|
#
|
32
|
-
# @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html
|
33
|
+
# @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html
|
33
34
|
#
|
34
35
|
def crawler_url_tracing_result(engine_name, arguments = {})
|
35
36
|
raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
|
@@ -27,9 +27,10 @@ module Elastic
|
|
27
27
|
# @param engine_name [String] Name of the engine (*Required*)
|
28
28
|
# @param arguments [Hash] endpoint arguments
|
29
29
|
# @option arguments [String] :body
|
30
|
+
# @option arguments [String] :url (*Required*)
|
30
31
|
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
31
32
|
#
|
32
|
-
# @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html
|
33
|
+
# @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html
|
33
34
|
#
|
34
35
|
def crawler_url_validation_result(engine_name, arguments = {})
|
35
36
|
raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
|
@@ -33,7 +33,6 @@ module Elastic
|
|
33
33
|
# @option body [String] :policy (*Required)
|
34
34
|
# @option body [String] :rule (*Required)
|
35
35
|
# @option body [String] :pattern (*Required)
|
36
|
-
# @option body [String] :created_at
|
37
36
|
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
38
37
|
#
|
39
38
|
# @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html#web-crawler-apis-post-crawl-rules
|
@@ -30,7 +30,6 @@ module Elastic
|
|
30
30
|
# @option arguments [Hash] :body (Required: value)
|
31
31
|
# @option body [String] :id
|
32
32
|
# @option body [String] :value (*Required)
|
33
|
-
# @option body [String] :created_at
|
34
33
|
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
35
34
|
#
|
36
35
|
# @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html#web-crawler-apis-post-entry-points
|
@@ -30,7 +30,6 @@ module Elastic
|
|
30
30
|
# @option arguments [Hash] :body (Required: url)
|
31
31
|
# @option body [String] :id
|
32
32
|
# @option body [String] :url (*Required)
|
33
|
-
# @option body [String] :created_at
|
34
33
|
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
35
34
|
#
|
36
35
|
# @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html#web-crawler-apis-post-sitemaps
|
@@ -31,7 +31,6 @@ module Elastic
|
|
31
31
|
# @option body [Array] :queries List of affected search queries (*Required)
|
32
32
|
# @option body [Array] :promoted List of promoted document IDs
|
33
33
|
# @option body [Array] :hidden List of hidden document IDs
|
34
|
-
# @option body :suggestion
|
35
34
|
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
36
35
|
#
|
37
36
|
# @see https://www.elastic.co/guide/en/app-search/current/curations.html#curations-create
|
@@ -26,11 +26,11 @@ module Elastic
|
|
26
26
|
#
|
27
27
|
# @param engine_name [String] Name of the engine (*Required*)
|
28
28
|
# @param arguments [Hash] endpoint arguments
|
29
|
-
# @option arguments
|
30
|
-
# @option body [String] :query
|
31
|
-
# @option body [String] :
|
32
|
-
# @option body :
|
33
|
-
# @option body [Array] :tags
|
29
|
+
# @option arguments :body Search request parameters
|
30
|
+
# @option body [String] :query Search query text (*Required*)
|
31
|
+
# @option body [String] :document_id The id of the document that was clicked on (*Required*)
|
32
|
+
# @option body [String] :request_id The request id returned in the meta tag of a search API response
|
33
|
+
# @option body [Array] :tags Array of strings representing additional information you wish to track with the clickthrough. You may submit up to 16 tags, and each may be up to 64 characters in length.
|
34
34
|
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
35
35
|
#
|
36
36
|
# @see https://www.elastic.co/guide/en/app-search/current/clickthrough.html
|
@@ -34,7 +34,6 @@ module Elastic
|
|
34
34
|
# @option body [String] :policy (*Required)
|
35
35
|
# @option body [String] :rule (*Required)
|
36
36
|
# @option body [String] :pattern (*Required)
|
37
|
-
# @option body [String] :created_at
|
38
37
|
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
39
38
|
#
|
40
39
|
# @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html#web-crawler-apis-put-crawl-rule
|
@@ -31,7 +31,6 @@ module Elastic
|
|
31
31
|
# @option arguments [Hash] :body (Required: value)
|
32
32
|
# @option body [String] :id
|
33
33
|
# @option body [String] :value (*Required)
|
34
|
-
# @option body [String] :created_at
|
35
34
|
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
36
35
|
#
|
37
36
|
# @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html#web-crawler-apis-put-entry-point
|
@@ -31,7 +31,6 @@ module Elastic
|
|
31
31
|
# @option arguments [Hash] :body (Required: url)
|
32
32
|
# @option body [String] :id
|
33
33
|
# @option body [String] :url (*Required)
|
34
|
-
# @option body [String] :created_at
|
35
34
|
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
36
35
|
#
|
37
36
|
# @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html#web-crawler-apis-put-sitemap
|
@@ -32,7 +32,6 @@ module Elastic
|
|
32
32
|
# @option body [Array] :queries List of affected search queries (*Required)
|
33
33
|
# @option body [Array] :promoted List of promoted document IDs
|
34
34
|
# @option body [Array] :hidden List of hidden document IDs
|
35
|
-
# @option body :suggestion
|
36
35
|
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
37
36
|
#
|
38
37
|
# @see https://www.elastic.co/guide/en/app-search/current/curations.html#curations-update
|
@@ -58,6 +58,7 @@ module Elastic
|
|
58
58
|
# @option options [String] :proxy url of proxy to use, ex: "http://localhost:8888"
|
59
59
|
# @option options [Boolean] :log Use the default logger (disabled by default)
|
60
60
|
# @option arguments [Object] :logger An instance of a Logger-compatible object
|
61
|
+
# @option arguments [Symbol] :adapter A specific adapter for Faraday (e.g. `:patron`)
|
61
62
|
# @option enable_meta_header [Boolean] :enable_meta_header Enable sending the meta data header to Cloud.
|
62
63
|
# (Default: true)
|
63
64
|
def initialize(options = {})
|
@@ -72,6 +73,7 @@ module Elastic
|
|
72
73
|
log: log,
|
73
74
|
logger: logger,
|
74
75
|
request_timeout: overall_timeout,
|
76
|
+
adapter: adapter,
|
75
77
|
transport_options: {
|
76
78
|
request: { open_timeout: open_timeout }
|
77
79
|
},
|
@@ -103,6 +105,10 @@ module Elastic
|
|
103
105
|
@options[:logger]
|
104
106
|
end
|
105
107
|
|
108
|
+
def adapter
|
109
|
+
@options[:adapter]
|
110
|
+
end
|
111
|
+
|
106
112
|
def host
|
107
113
|
return DEFAULT_HOST unless @options[:host]
|
108
114
|
|
@@ -24,7 +24,7 @@ require 'base64'
|
|
24
24
|
|
25
25
|
module Elastic
|
26
26
|
module EnterpriseSearch
|
27
|
-
CLIENT_NAME = 'elastic-
|
27
|
+
CLIENT_NAME = 'elastic-enterprise-search-ruby'
|
28
28
|
CLIENT_VERSION = Elastic::EnterpriseSearch::VERSION
|
29
29
|
|
30
30
|
# Module included in Elastic::Enterprise::Client for http requests.
|
@@ -85,4 +85,33 @@ describe Elastic::EnterpriseSearch::AppSearch::Client do
|
|
85
85
|
expect(decoded_token[0]['query']).to(eq('cat'))
|
86
86
|
end
|
87
87
|
end
|
88
|
+
|
89
|
+
context 'adapters' do
|
90
|
+
let(:client) { described_class.new }
|
91
|
+
let(:adapter) { client.transport.transport.connections.all.first.connection.builder.adapter }
|
92
|
+
|
93
|
+
context 'when no adapter is specified' do
|
94
|
+
it 'uses Faraday NetHttp' do
|
95
|
+
expect(adapter).to eq Faraday::Adapter::NetHttp
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
context 'when the adapter is patron' do
|
100
|
+
let(:client) { described_class.new(adapter: :patron) }
|
101
|
+
|
102
|
+
it 'uses Faraday with the adapter' do
|
103
|
+
expect(adapter).to eq Faraday::Adapter::Patron
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
unless defined?(JRUBY_VERSION)
|
108
|
+
context 'when the adapter is typhoeus' do
|
109
|
+
let(:client) { described_class.new(adapter: :patron) }
|
110
|
+
|
111
|
+
it 'uses Faraday with the adapter' do
|
112
|
+
expect(adapter).to eq Faraday::Adapter::Patron
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
88
117
|
end
|
@@ -103,4 +103,33 @@ describe Elastic::EnterpriseSearch::Client do
|
|
103
103
|
expect(subject['x-elastic-client-meta']).to match(/^ent=[0-9]+\.[0-9]+\.[0-9]+(p)?,/)
|
104
104
|
end
|
105
105
|
end
|
106
|
+
|
107
|
+
context 'adapters' do
|
108
|
+
let(:client) { described_class.new }
|
109
|
+
let(:adapter) { client.transport.transport.connections.all.first.connection.builder.adapter }
|
110
|
+
|
111
|
+
context 'when no adapter is specified' do
|
112
|
+
it 'uses Faraday NetHttp' do
|
113
|
+
expect(adapter).to eq Faraday::Adapter::NetHttp
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
context 'when the adapter is patron' do
|
118
|
+
let(:client) { described_class.new(adapter: :patron) }
|
119
|
+
|
120
|
+
it 'uses Faraday with the adapter' do
|
121
|
+
expect(adapter).to eq Faraday::Adapter::Patron
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
unless defined?(JRUBY_VERSION)
|
126
|
+
context 'when the adapter is typhoeus' do
|
127
|
+
let(:client) { described_class.new(adapter: :patron) }
|
128
|
+
|
129
|
+
it 'uses Faraday with the adapter' do
|
130
|
+
expect(adapter).to eq Faraday::Adapter::Patron
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
106
135
|
end
|
@@ -10,7 +10,7 @@ http_interactions:
|
|
10
10
|
X-Elastic-Client-Meta:
|
11
11
|
- es=7.11.0.pre.1,rb=2.7.2,t=7.11.0.pre.1,fd=1.3.0,nh=1.1
|
12
12
|
User-Agent:
|
13
|
-
- 'elastic-
|
13
|
+
- 'elastic-enterprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
|
14
14
|
elasticsearch-transport: 7.11.0.pre.1)'
|
15
15
|
Content-Type:
|
16
16
|
- application/json
|
@@ -10,7 +10,7 @@ http_interactions:
|
|
10
10
|
X-Elastic-Client-Meta:
|
11
11
|
- es=7.11.0.pre.1,rb=2.7.2,t=7.11.0.pre.1,fd=1.3.0,nh=1.1
|
12
12
|
User-Agent:
|
13
|
-
- 'elastic-
|
13
|
+
- 'elastic-enterprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
|
14
14
|
elasticsearch-transport: 7.11.0.pre.1)'
|
15
15
|
Content-Type:
|
16
16
|
- application/json
|
@@ -10,7 +10,7 @@ http_interactions:
|
|
10
10
|
X-Elastic-Client-Meta:
|
11
11
|
- es=7.11.0.pre.1,rb=2.7.2,t=7.11.0.pre.1,fd=1.3.0,nh=1.1
|
12
12
|
User-Agent:
|
13
|
-
- 'elastic-
|
13
|
+
- 'elastic-enterprise-search-ruby/7.11.0.pre (RUBY_VERSION: 2.7.2; linux x86_64;
|
14
14
|
elasticsearch-transport: 7.11.0.pre.1)'
|
15
15
|
Content-Type:
|
16
16
|
- application/json
|
@@ -34,7 +34,7 @@ describe Elastic::EnterpriseSearch::AppSearch::Client do
|
|
34
34
|
sleep 1
|
35
35
|
end
|
36
36
|
|
37
|
-
it 'creates
|
37
|
+
it 'creates and gets a crawler domain' do
|
38
38
|
body = { name: name }
|
39
39
|
response = client.create_crawler_domain(engine_name, body: body)
|
40
40
|
@domain = response.body
|
@@ -48,11 +48,6 @@ describe Elastic::EnterpriseSearch::AppSearch::Client do
|
|
48
48
|
expect(response.status).to eq 200
|
49
49
|
expect(response.body['id']).to eq @domain['id']
|
50
50
|
expect(response.body).to include('name' => name)
|
51
|
-
|
52
|
-
# client.list_crawler_domains
|
53
|
-
response = client.list_crawler_domains(engine_name)
|
54
|
-
expect(response.status).to eq 200
|
55
|
-
expect(response.body['results'].first['id']).to eq(@domain['id'])
|
56
51
|
end
|
57
52
|
|
58
53
|
it 'creates and updates a crawler domain' do
|
@@ -96,4 +96,33 @@ describe Elastic::EnterpriseSearch::WorkplaceSearch::Client do
|
|
96
96
|
expect(client.authorization_url('client_id', 'https://localhost:3002')).to eq authorization_url
|
97
97
|
end
|
98
98
|
end
|
99
|
+
|
100
|
+
context 'adapters' do
|
101
|
+
let(:client) { described_class.new }
|
102
|
+
let(:adapter) { client.transport.transport.connections.all.first.connection.builder.adapter }
|
103
|
+
|
104
|
+
context 'when no adapter is specified' do
|
105
|
+
it 'uses Faraday NetHttp' do
|
106
|
+
expect(adapter).to eq Faraday::Adapter::NetHttp
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
context 'when the adapter is patron' do
|
111
|
+
let(:client) { described_class.new(adapter: :patron) }
|
112
|
+
|
113
|
+
it 'uses Faraday with the adapter' do
|
114
|
+
expect(adapter).to eq Faraday::Adapter::Patron
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
unless defined?(JRUBY_VERSION)
|
119
|
+
context 'when the adapter is typhoeus' do
|
120
|
+
let(:client) { described_class.new(adapter: :patron) }
|
121
|
+
|
122
|
+
it 'uses Faraday with the adapter' do
|
123
|
+
expect(adapter).to eq Faraday::Adapter::Patron
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
99
128
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic-enterprise-search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.17.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Briano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elasticsearch-transport
|
@@ -183,9 +183,12 @@ files:
|
|
183
183
|
- ".github/workflows/testing.yml"
|
184
184
|
- ".gitignore"
|
185
185
|
- ".rubocop.yml"
|
186
|
+
- CHANGELOG
|
187
|
+
- CODE_OF_CONDUCT
|
186
188
|
- CONTRIBUTING.md
|
187
189
|
- Gemfile
|
188
190
|
- LICENSE
|
191
|
+
- NOTICE
|
189
192
|
- README.md
|
190
193
|
- Rakefile
|
191
194
|
- docs/guide/app-search-api.asciidoc
|
@@ -202,14 +205,13 @@ files:
|
|
202
205
|
- docs/guide/release_notes/714.asciidoc
|
203
206
|
- docs/guide/release_notes/715.asciidoc
|
204
207
|
- docs/guide/release_notes/716.asciidoc
|
208
|
+
- docs/guide/release_notes/717.asciidoc
|
205
209
|
- docs/guide/release_notes/index.asciidoc
|
206
210
|
- docs/guide/workplace-search-api.asciidoc
|
207
211
|
- elastic-enterprise-search.gemspec
|
208
212
|
- lib/data/ca-bundle.crt
|
209
213
|
- lib/elastic-enterprise-search.rb
|
210
214
|
- lib/elastic/.rubocop.yml
|
211
|
-
- lib/elastic/app-search/api/adaptive_relevance_settings.rb
|
212
|
-
- lib/elastic/app-search/api/adaptive_relevance_suggestions.rb
|
213
215
|
- lib/elastic/app-search/api/add_meta_engine_source.rb
|
214
216
|
- lib/elastic/app-search/api/api_key.rb
|
215
217
|
- lib/elastic/app-search/api/api_logs.rb
|
@@ -255,10 +257,8 @@ files:
|
|
255
257
|
- lib/elastic/app-search/api/documents.rb
|
256
258
|
- lib/elastic/app-search/api/engine.rb
|
257
259
|
- lib/elastic/app-search/api/index_documents.rb
|
258
|
-
- lib/elastic/app-search/api/list_adaptive_relevance_suggestions.rb
|
259
260
|
- lib/elastic/app-search/api/list_api_keys.rb
|
260
261
|
- lib/elastic/app-search/api/list_crawler_crawl_requests.rb
|
261
|
-
- lib/elastic/app-search/api/list_crawler_domains.rb
|
262
262
|
- lib/elastic/app-search/api/list_crawler_process_crawls.rb
|
263
263
|
- lib/elastic/app-search/api/list_curations.rb
|
264
264
|
- lib/elastic/app-search/api/list_documents.rb
|
@@ -266,8 +266,6 @@ files:
|
|
266
266
|
- lib/elastic/app-search/api/list_synonym_sets.rb
|
267
267
|
- lib/elastic/app-search/api/log_clickthrough.rb
|
268
268
|
- lib/elastic/app-search/api/multi_search.rb
|
269
|
-
- lib/elastic/app-search/api/put_adaptive_relevance_settings.rb
|
270
|
-
- lib/elastic/app-search/api/put_adaptive_relevance_suggestions.rb
|
271
269
|
- lib/elastic/app-search/api/put_api_key.rb
|
272
270
|
- lib/elastic/app-search/api/put_crawler_crawl_rule.rb
|
273
271
|
- lib/elastic/app-search/api/put_crawler_crawl_schedule.rb
|
@@ -344,7 +342,6 @@ files:
|
|
344
342
|
- spec/fixtures/vcr/workplace_search/create_analytics_event.yml
|
345
343
|
- spec/fixtures/vcr/workplace_search/oauth_request_token.yml
|
346
344
|
- spec/fixtures/vcr/workplace_search/search_request.yml
|
347
|
-
- spec/integration/app-search/adaptive_relevance_spec.rb
|
348
345
|
- spec/integration/app-search/api_key_spec.rb
|
349
346
|
- spec/integration/app-search/api_logs_spec.rb
|
350
347
|
- spec/integration/app-search/app_search_helper.rb
|
@@ -412,7 +409,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
412
409
|
- !ruby/object:Gem::Version
|
413
410
|
version: '0'
|
414
411
|
requirements: []
|
415
|
-
rubygems_version: 3.
|
412
|
+
rubygems_version: 3.3.7
|
416
413
|
signing_key:
|
417
414
|
specification_version: 4
|
418
415
|
summary: Official API client for Elastic Enterprise Search
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Licensed to Elasticsearch B.V. under one or more contributor
|
4
|
-
# license agreements. See the NOTICE file distributed with
|
5
|
-
# this work for additional information regarding copyright
|
6
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
7
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
8
|
-
# not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
module Elastic
|
21
|
-
module EnterpriseSearch
|
22
|
-
module AppSearch
|
23
|
-
module Actions
|
24
|
-
# AdaptiveRelevanceSettings - Retrieve adaptive relevance settings
|
25
|
-
# Retrieve adaptive relevance settings
|
26
|
-
#
|
27
|
-
# @param engine_name [String] Name of the engine (*Required*)
|
28
|
-
# @param arguments [Hash] endpoint arguments
|
29
|
-
# @option arguments [Hash] :body The request body
|
30
|
-
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
31
|
-
#
|
32
|
-
# @see https://www.elastic.co/guide/en/app-search/current/adaptive-relevance-api-reference.html#adaptive-relevance-api-get-engine-adaptive-relevance-settings
|
33
|
-
#
|
34
|
-
def adaptive_relevance_settings(engine_name, arguments = {})
|
35
|
-
raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
|
36
|
-
|
37
|
-
body = arguments.delete(:body) || {}
|
38
|
-
headers = arguments.delete(:headers) || {}
|
39
|
-
|
40
|
-
request(
|
41
|
-
:get,
|
42
|
-
"api/as/v0/engines/#{engine_name}/adaptive_relevance/settings/",
|
43
|
-
arguments,
|
44
|
-
body,
|
45
|
-
headers
|
46
|
-
)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Licensed to Elasticsearch B.V. under one or more contributor
|
4
|
-
# license agreements. See the NOTICE file distributed with
|
5
|
-
# this work for additional information regarding copyright
|
6
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
7
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
8
|
-
# not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
module Elastic
|
21
|
-
module EnterpriseSearch
|
22
|
-
module AppSearch
|
23
|
-
module Actions
|
24
|
-
# AdaptiveRelevanceSuggestions - Retrieve adaptive relevance
|
25
|
-
# Retrieve adaptive relevance for a single query
|
26
|
-
#
|
27
|
-
# @param engine_name [String] Name of the engine (*Required*)
|
28
|
-
# @param arguments [Hash] endpoint arguments
|
29
|
-
# @option arguments [String] :search_suggestion_query Query to obtain suggestions (*Required*)
|
30
|
-
# @option arguments [Hash] :body
|
31
|
-
# @option body :page
|
32
|
-
# @option body :filters
|
33
|
-
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
34
|
-
#
|
35
|
-
# @see https://www.elastic.co/guide/en/app-search/current/adaptive-relevance-api-reference.html#adaptive-relevance-api-get-engine-adaptive-relevance-suggestions-query
|
36
|
-
#
|
37
|
-
def adaptive_relevance_suggestions(engine_name, arguments = {})
|
38
|
-
raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
|
39
|
-
raise ArgumentError, "Required parameter 'search_suggestion_query' missing" unless arguments[:search_suggestion_query]
|
40
|
-
|
41
|
-
search_suggestion_query = arguments[:search_suggestion_query]
|
42
|
-
body = arguments.delete(:body) || {}
|
43
|
-
headers = arguments.delete(:headers) || {}
|
44
|
-
|
45
|
-
request(
|
46
|
-
:post,
|
47
|
-
"api/as/v0/engines/#{engine_name}/adaptive_relevance/suggestions/#{search_suggestion_query}/",
|
48
|
-
arguments,
|
49
|
-
body,
|
50
|
-
headers
|
51
|
-
)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Licensed to Elasticsearch B.V. under one or more contributor
|
4
|
-
# license agreements. See the NOTICE file distributed with
|
5
|
-
# this work for additional information regarding copyright
|
6
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
7
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
8
|
-
# not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
module Elastic
|
21
|
-
module EnterpriseSearch
|
22
|
-
module AppSearch
|
23
|
-
module Actions
|
24
|
-
# AdaptiveRelevanceSuggestions - Retrieve adaptive relevance
|
25
|
-
# Retrieve adaptive relevance
|
26
|
-
#
|
27
|
-
# @param engine_name [String] Name of the engine (*Required*)
|
28
|
-
# @param arguments [Hash] endpoint arguments
|
29
|
-
# @option arguments [Hash] :body
|
30
|
-
# @option body :page
|
31
|
-
# @option body :filters
|
32
|
-
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
33
|
-
#
|
34
|
-
# @see https://www.elastic.co/guide/en/app-search/current/adaptive-relevance-api-reference.html#adaptive-relevance-api-get-engine-adaptive-relevance-suggestions
|
35
|
-
#
|
36
|
-
def list_adaptive_relevance_suggestions(engine_name, arguments = {})
|
37
|
-
raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
|
38
|
-
|
39
|
-
body = arguments.delete(:body) || {}
|
40
|
-
headers = arguments.delete(:headers) || {}
|
41
|
-
|
42
|
-
request(
|
43
|
-
:post,
|
44
|
-
"api/as/v0/engines/#{engine_name}/adaptive_relevance/suggestions/",
|
45
|
-
arguments,
|
46
|
-
body,
|
47
|
-
headers
|
48
|
-
)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Licensed to Elasticsearch B.V. under one or more contributor
|
4
|
-
# license agreements. See the NOTICE file distributed with
|
5
|
-
# this work for additional information regarding copyright
|
6
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
7
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
8
|
-
# not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
module Elastic
|
21
|
-
module EnterpriseSearch
|
22
|
-
module AppSearch
|
23
|
-
module Actions
|
24
|
-
# Crawler - List crawler domains
|
25
|
-
# Returns a list of crawler domains
|
26
|
-
#
|
27
|
-
# @param engine_name [String] Name of the engine (*Required*)
|
28
|
-
# @param arguments [Hash] endpoint arguments
|
29
|
-
# @option arguments [Hash] :body The request body
|
30
|
-
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
31
|
-
#
|
32
|
-
# @see https://www.elastic.co/guide/en/app-search/current/web-crawler-api-reference.html#web-crawler-apis-get-crawler-domain
|
33
|
-
#
|
34
|
-
def list_crawler_domains(engine_name, arguments = {})
|
35
|
-
raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
|
36
|
-
|
37
|
-
body = arguments.delete(:body) || {}
|
38
|
-
headers = arguments.delete(:headers) || {}
|
39
|
-
|
40
|
-
request(
|
41
|
-
:get,
|
42
|
-
"api/as/v0/engines/#{engine_name}/crawler/domains/",
|
43
|
-
arguments,
|
44
|
-
body,
|
45
|
-
headers
|
46
|
-
)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Licensed to Elasticsearch B.V. under one or more contributor
|
4
|
-
# license agreements. See the NOTICE file distributed with
|
5
|
-
# this work for additional information regarding copyright
|
6
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
7
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
8
|
-
# not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
module Elastic
|
21
|
-
module EnterpriseSearch
|
22
|
-
module AppSearch
|
23
|
-
module Actions
|
24
|
-
# AdaptiveRelevanceSettings - Update adaptive relevance settings
|
25
|
-
# Update adaptive relevance settings
|
26
|
-
#
|
27
|
-
# @param engine_name [String] Name of the engine (*Required*)
|
28
|
-
# @param arguments [Hash] endpoint arguments
|
29
|
-
# @option arguments [Hash] :body (Required: curation)
|
30
|
-
# @option body [Object] :curation (*Required)
|
31
|
-
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
32
|
-
#
|
33
|
-
# @see https://www.elastic.co/guide/en/app-search/current/adaptive-relevance-api-reference.html#adaptive-relevance-api-put-engine-adaptive-relevance-settings
|
34
|
-
#
|
35
|
-
def put_adaptive_relevance_settings(engine_name, arguments = {})
|
36
|
-
raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
|
37
|
-
|
38
|
-
body = arguments.delete(:body) || {}
|
39
|
-
headers = arguments.delete(:headers) || {}
|
40
|
-
|
41
|
-
request(
|
42
|
-
:put,
|
43
|
-
"api/as/v0/engines/#{engine_name}/adaptive_relevance/settings/",
|
44
|
-
arguments,
|
45
|
-
body,
|
46
|
-
headers
|
47
|
-
)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Licensed to Elasticsearch B.V. under one or more contributor
|
4
|
-
# license agreements. See the NOTICE file distributed with
|
5
|
-
# this work for additional information regarding copyright
|
6
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
7
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
8
|
-
# not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
module Elastic
|
21
|
-
module EnterpriseSearch
|
22
|
-
module AppSearch
|
23
|
-
module Actions
|
24
|
-
# AdaptiveRelevanceSuggestions - Update adaptive relevance
|
25
|
-
# Update adaptive relevance
|
26
|
-
#
|
27
|
-
# @param engine_name [String] Name of the engine (*Required*)
|
28
|
-
# @param arguments [Hash] endpoint arguments
|
29
|
-
# @option arguments [Array] :body
|
30
|
-
# @option arguments [Hash] :headers optional HTTP headers to send with the request
|
31
|
-
#
|
32
|
-
# @see https://www.elastic.co/guide/en/app-search/current/adaptive-relevance-api-reference.html#adaptive-relevance-api-put-engine-adaptive-relevance-suggestions
|
33
|
-
#
|
34
|
-
def put_adaptive_relevance_suggestions(engine_name, arguments = {})
|
35
|
-
raise ArgumentError, "Required parameter 'engine_name' missing" unless engine_name
|
36
|
-
|
37
|
-
body = arguments.delete(:body) || {}
|
38
|
-
headers = arguments.delete(:headers) || {}
|
39
|
-
|
40
|
-
request(
|
41
|
-
:put,
|
42
|
-
"api/as/v0/engines/#{engine_name}/adaptive_relevance/suggestions/",
|
43
|
-
arguments,
|
44
|
-
body,
|
45
|
-
headers
|
46
|
-
)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# Licensed to Elasticsearch B.V. under one or more contributor
|
2
|
-
# license agreements. See the NOTICE file distributed with
|
3
|
-
# this work for additional information regarding copyright
|
4
|
-
# ownership. Elasticsearch B.V. licenses this file to you under
|
5
|
-
# the Apache License, Version 2.0 (the "License"); you may
|
6
|
-
# not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing,
|
12
|
-
# software distributed under the License is distributed on an
|
13
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
-
# KIND, either express or implied. See the License for the
|
15
|
-
# specific language governing permissions and limitations
|
16
|
-
# under the License.
|
17
|
-
|
18
|
-
# frozen_string_literal: true
|
19
|
-
|
20
|
-
require_relative "#{__dir__}/app_search_helper.rb"
|
21
|
-
|
22
|
-
describe Elastic::EnterpriseSearch::AppSearch::Client do
|
23
|
-
context 'Adaptive Relevance' do
|
24
|
-
let(:engine_name) { 'adaptive-relevance' }
|
25
|
-
|
26
|
-
before do
|
27
|
-
create_engine(engine_name)
|
28
|
-
end
|
29
|
-
|
30
|
-
after do
|
31
|
-
delete_engines
|
32
|
-
end
|
33
|
-
|
34
|
-
it 'retrieves adaptive relevance settings' do
|
35
|
-
response = client.adaptive_relevance_settings(engine_name)
|
36
|
-
expect(response.body['curation'])
|
37
|
-
expect(response.status).to eq 200
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'updates settings and lists adaptive relevance for an engine' do
|
41
|
-
body = { curation: { enabled: true } }
|
42
|
-
# Enables curations
|
43
|
-
response = client.put_adaptive_relevance_settings(engine_name, body: body)
|
44
|
-
expect(response.status).to eq 200
|
45
|
-
expect(response.body.dig('curation', 'enabled'))
|
46
|
-
|
47
|
-
# Lists suggestions
|
48
|
-
response = client.list_adaptive_relevance_suggestions(engine_name)
|
49
|
-
expect(response.status).to eq 200
|
50
|
-
expect(response.body['meta'])
|
51
|
-
expect(response.body['results'])
|
52
|
-
end
|
53
|
-
|
54
|
-
xit 'updates adaptive relevance' do
|
55
|
-
body = { curation: { enabled: true } }
|
56
|
-
client.put_adaptive_relevance_settings(engine_name, body: body)
|
57
|
-
|
58
|
-
# Index document and create curation:
|
59
|
-
id = client.index_documents(engine_name, documents: [{ title: 'experiment' }]).body.first['id']
|
60
|
-
body = { queries: ['test'], promoted: [id] }
|
61
|
-
client.create_curation(engine_name, body: body)
|
62
|
-
body = [{ query: 'test', type: 'curation', status: 'applied' }]
|
63
|
-
response = client.put_adaptive_relevance_suggestions(engine_name, body: body)
|
64
|
-
|
65
|
-
expect(response.status).to eq 200
|
66
|
-
end
|
67
|
-
|
68
|
-
xit 'retrieves an adaptive relevance' do
|
69
|
-
# Enables curations
|
70
|
-
client.put_adaptive_relevance_settings(engine_name, body: { curation: { enabled: true } })
|
71
|
-
id = client.index_documents(engine_name, documents: [{ title: 'experiment' }]).body.first['id']
|
72
|
-
body = { queries: ['test'], promoted: [id] }
|
73
|
-
client.create_curation(engine_name, body: body)
|
74
|
-
|
75
|
-
response = client.adaptive_relevance_suggestions(engine_name, search_suggestion_query: 'test')
|
76
|
-
expect(response.status).to eq 200
|
77
|
-
expect(response.body)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|