Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Add examples for ES quickstart #2116

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docs/examples/36b86b97feedcf5632824eefc251d6ed.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// getting-started.asciidoc:245

[source, js]
----
const resp = await client.search({
index: 'books',
query: {
match: {
name: "brave"
}
}
});
console.log(resp);
----
15 changes: 15 additions & 0 deletions docs/examples/8575c966b004fb124c7afd6bb5827b50.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// getting-started.asciidoc:65

[source,js]
----
resp = await client.index({
index: 'books',
document: {
name: "Snow Crash",
author: "Neal Stephenson",
release_date: "1992-06-01",
page_count: 470
}
});
console.log(resp);
----
9 changes: 9 additions & 0 deletions docs/examples/bcc75fc01b45e482638c65b8fbdf09fa.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// getting-started.asciidoc:228

[source,js]
----
resp = await client.search({
index: 'books'
});
console.log(resp.hits.hits);
----
42 changes: 42 additions & 0 deletions docs/examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// getting-started.asciidoc:104

resp = await client.bulk({
operations: [
{ index: { _index: 'books' } },
{
name: "Revelation Space",
author: "Alastair Reynolds",
release_date: "2000-03-15",
page_count: 585
},
{ index: { _index: 'books' } },
{
name: "1984",
author: "George Orwell",
release_date: "1985-06-01",
page_count: 328
},
{ index: { _index: 'books' } },
{
name: "Fahrenheit 451",
author: "Ray Bradbury",
release_date: "1953-10-15",
page_count: 227
},
{ index: { _index: 'books' } },
{
name: "Brave New World",
author: "Aldous Huxley",
release_date: "1932-06-01",
page_count: 268
},
{ index: { _index: 'books' } },
{
name: "The Handmaids Tale",
author: "Margaret Atwood",
release_date: "1985-06-01",
page_count: 311
}
]
});
console.log(resp);