-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e590347
commit 9aab364
Showing
44 changed files
with
685 additions
and
31 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
docs/examples/guide/0350410d11579f4e876c798ce1eaef5b.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[source, ruby] | ||
---- | ||
response = client.index( | ||
index: 'my-index-000001', | ||
id: 5, | ||
refresh: true, | ||
body: { | ||
query: { | ||
bool: { | ||
should: [ | ||
{ | ||
match: { | ||
message: { | ||
query: 'Japanese art', | ||
_name: 'query1' | ||
} | ||
} | ||
}, | ||
{ | ||
match: { | ||
message: { | ||
query: 'Holand culture', | ||
_name: 'query2' | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
) | ||
puts response | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
docs/examples/guide/2e93eaaebf75fa4a2451e8a76ffa9f20.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[source, ruby] | ||
---- | ||
response = client.indices.put_index_template( | ||
name: 'my-data-stream-template', | ||
body: { | ||
index_patterns: [ | ||
'my-data-stream*' | ||
], | ||
data_stream: {}, | ||
priority: 500, | ||
template: { | ||
mappings: { | ||
properties: { | ||
message: { | ||
type: 'text' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
) | ||
puts response | ||
---- |
8 changes: 8 additions & 0 deletions
8
docs/examples/guide/33d480fc6812ada75756cf5337bc9092.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[source, ruby] | ||
---- | ||
response = client.connector_sync_job.list( | ||
from: 0, | ||
size: 2 | ||
) | ||
puts response | ||
---- |
12 changes: 12 additions & 0 deletions
12
docs/examples/guide/342ddf9121aeddd82fea2464665e25da.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[source, ruby] | ||
---- | ||
response = client.connector.put( | ||
connector_id: 'my-connector', | ||
body: { | ||
index_name: 'search-google-drive', | ||
name: 'My Connector', | ||
service_type: 'google_drive' | ||
} | ||
) | ||
puts response | ||
---- |
24 changes: 24 additions & 0 deletions
24
docs/examples/guide/34d63740b58209a3d031212909743925.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[source, ruby] | ||
---- | ||
response = client.search( | ||
index: 'openai-embeddings', | ||
body: { | ||
knn: { | ||
field: 'content_embedding', | ||
query_vector_builder: { | ||
text_embedding: { | ||
model_id: 'openai_embeddings', | ||
model_text: 'Calculate fuel cost' | ||
} | ||
}, | ||
k: 10, | ||
num_candidates: 100 | ||
}, | ||
_source: [ | ||
'id', | ||
'content' | ||
] | ||
} | ||
) | ||
puts response | ||
---- |
15 changes: 15 additions & 0 deletions
15
docs/examples/guide/360b3cef34bbddc5d9579ca95f0cb061.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[source, ruby] | ||
---- | ||
response = client.indices.put_mapping( | ||
index: 'my-data-stream', | ||
write_index_only: true, | ||
body: { | ||
properties: { | ||
message: { | ||
type: 'text' | ||
} | ||
} | ||
} | ||
) | ||
puts response | ||
---- |
7 changes: 7 additions & 0 deletions
7
docs/examples/guide/365256ebdfa47b449780771d9beba8d9.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[source, ruby] | ||
---- | ||
response = client.connector_sync_job.check_in( | ||
connector_sync_job_id: 'my-connector-sync-job' | ||
) | ||
puts response | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
docs/examples/guide/370b297ed3433577adf53e64f572d89d.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[source, ruby] | ||
---- | ||
response = client.connector_sync_job.delete( | ||
connector_sync_job_id: 'my-connector-sync-job-id' | ||
) | ||
puts response | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
docs/examples/guide/3e4227250d49e81df48773f8ba803ea7.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[source, ruby] | ||
---- | ||
response = client.indices.put_mapping( | ||
index: 'my-data-stream', | ||
body: { | ||
properties: { | ||
message: { | ||
type: 'text' | ||
} | ||
} | ||
} | ||
) | ||
puts response | ||
---- |
11 changes: 11 additions & 0 deletions
11
docs/examples/guide/405ac843a9156d3cab374e199cac87fb.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[source, ruby] | ||
---- | ||
response = client.connector_sync_job.post( | ||
body: { | ||
id: 'connector-id', | ||
job_type: 'full', | ||
trigger_method: 'on_demand' | ||
} | ||
) | ||
puts response | ||
---- |
15 changes: 15 additions & 0 deletions
15
docs/examples/guide/41175d304e660da2931764f9a4418fd3.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[source, ruby] | ||
---- | ||
response = client.connector.update_pipeline( | ||
connector_id: 'my-connector', | ||
body: { | ||
pipeline: { | ||
extract_binary_content: true, | ||
name: 'my-connector-pipeline', | ||
reduce_whitespace: true, | ||
run_ml_inference: true | ||
} | ||
} | ||
) | ||
puts response | ||
---- |
19 changes: 19 additions & 0 deletions
19
docs/examples/guide/46103fee3cd5f53dc75123def82d52ad.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[source, ruby] | ||
---- | ||
response = client.indices.put_index_template( | ||
name: 'my-data-stream-template', | ||
body: { | ||
index_patterns: [ | ||
'my-data-stream*' | ||
], | ||
data_stream: {}, | ||
priority: 500, | ||
template: { | ||
settings: { | ||
'index.refresh_interval' => '30s' | ||
} | ||
} | ||
} | ||
) | ||
puts response | ||
---- |
28 changes: 28 additions & 0 deletions
28
docs/examples/guide/4be20da16d2b58216e8b307218c7bf3a.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
[source, ruby] | ||
---- | ||
response = client.indices.put_index_template( | ||
name: 'my-data-stream-template', | ||
body: { | ||
index_patterns: [ | ||
'my-data-stream*' | ||
], | ||
data_stream: {}, | ||
priority: 500, | ||
template: { | ||
mappings: { | ||
properties: { | ||
host: { | ||
properties: { | ||
ip: { | ||
type: 'ip', | ||
ignore_malformed: true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
) | ||
puts response | ||
---- |
43 changes: 43 additions & 0 deletions
43
docs/examples/guide/4fcca1687d7b2cf08de526539fea5a76.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[source, ruby] | ||
---- | ||
response = client.search( | ||
index: 'my-index', | ||
body: { | ||
query: { | ||
bool: { | ||
should: [ | ||
{ | ||
text_expansion: { | ||
'ml.inference.title_expanded.predicted_value' => { | ||
model_id: '.elser_model_2', | ||
model_text: 'How is the weather in Jamaica?', | ||
boost: 1 | ||
} | ||
} | ||
}, | ||
{ | ||
text_expansion: { | ||
'ml.inference.description_expanded.predicted_value' => { | ||
model_id: '.elser_model_2', | ||
model_text: 'How is the weather in Jamaica?', | ||
boost: 1 | ||
} | ||
} | ||
}, | ||
{ | ||
multi_match: { | ||
query: 'How is the weather in Jamaica?', | ||
fields: [ | ||
'title', | ||
'description' | ||
], | ||
boost: 4 | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
) | ||
puts response | ||
---- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
docs/examples/guide/640621cea39cdeeb76fbc95bff31a18d.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[source, ruby] | ||
---- | ||
response = client.connector.last_sync( | ||
connector_id: 'my-connector', | ||
body: { | ||
last_access_control_sync_error: 'Houston, we have a problem!', | ||
last_access_control_sync_scheduled_at: '2023-11-09T15:13:08.231Z', | ||
last_access_control_sync_status: 'pending', | ||
last_deleted_document_count: 42, | ||
last_incremental_sync_scheduled_at: '2023-11-09T15:13:08.231Z', | ||
last_indexed_document_count: 42, | ||
last_sync_error: 'Houston, we have a problem!', | ||
last_sync_scheduled_at: '2024-11-09T15:13:08.231Z', | ||
last_sync_status: 'completed', | ||
last_synced: '2024-11-09T15:13:08.231Z' | ||
} | ||
) | ||
puts response | ||
---- |
17 changes: 17 additions & 0 deletions
17
docs/examples/guide/65e892a362d940e4a74965f21c15ca09.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[source, ruby] | ||
---- | ||
response = client.reindex( | ||
wait_for_completion: false, | ||
body: { | ||
source: { | ||
index: 'test-data', | ||
size: 50 | ||
}, | ||
dest: { | ||
index: 'openai-embeddings', | ||
pipeline: 'openai_embeddings' | ||
} | ||
} | ||
) | ||
puts response | ||
---- |
24 changes: 24 additions & 0 deletions
24
docs/examples/guide/6843d859e2965d17cad4f033c81db83f.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[source, ruby] | ||
---- | ||
response = client.indices.put_index_template( | ||
name: 'my-data-stream-template', | ||
body: { | ||
index_patterns: [ | ||
'my-data-stream*' | ||
], | ||
data_stream: {}, | ||
priority: 500, | ||
template: { | ||
settings: { | ||
'sort.field' => [ | ||
'@timestamp' | ||
], | ||
'sort.order' => [ | ||
'desc' | ||
] | ||
} | ||
} | ||
} | ||
) | ||
puts response | ||
---- |
7 changes: 7 additions & 0 deletions
7
docs/examples/guide/6b8c5c8145c287c4fc535fa57ccf95a7.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[source, ruby] | ||
---- | ||
response = client.connector_sync_job.list( | ||
status: 'pending' | ||
) | ||
puts response | ||
---- |
Oops, something went wrong.