Files
elasticsearch-js/docs/doc_examples/b26b5574438e4eaf146b2428bf537c51.asciidoc
github-actions[bot] b4eb8e5441 [Backport 8.15] Added/updated snippets for docs (#2319)
(cherry picked from commit f737290d10)

Co-authored-by: Josh Mock <joshua.mock@elastic.co>
2024-07-29 17:10:42 -05:00

51 lines
1.0 KiB
Plaintext

// This file is autogenerated, DO NOT EDIT
// Use `node scripts/generate-docs-examples.js` to generate the docs examples
[source, js]
----
const response = await client.ingest.putPipeline({
id: "attachment",
description: "Extract attachment information from arrays",
processors: [
{
foreach: {
field: "attachments",
processor: {
attachment: {
target_field: "_ingest._value.attachment",
field: "_ingest._value.data",
remove_binary: false,
},
},
},
},
],
});
console.log(response);
const response1 = await client.index({
index: "my-index-000001",
id: "my_id",
pipeline: "attachment",
document: {
attachments: [
{
filename: "ipsum.txt",
data: "dGhpcyBpcwpqdXN0IHNvbWUgdGV4dAo=",
},
{
filename: "test.txt",
data: "VGhpcyBpcyBhIHRlc3QK",
},
],
},
});
console.log(response1);
const response2 = await client.get({
index: "my-index-000001",
id: "my_id",
});
console.log(response2);
----