58 lines
1.0 KiB
Plaintext
58 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.indices.create({
|
|
index: "index",
|
|
settings: {
|
|
analysis: {
|
|
analyzer: {
|
|
english_exact: {
|
|
tokenizer: "standard",
|
|
filter: ["lowercase"],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
mappings: {
|
|
properties: {
|
|
body: {
|
|
type: "text",
|
|
analyzer: "english",
|
|
fields: {
|
|
exact: {
|
|
type: "text",
|
|
analyzer: "english_exact",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
|
|
const response1 = await client.index({
|
|
index: "index",
|
|
id: 1,
|
|
document: {
|
|
body: "Ski resort",
|
|
},
|
|
});
|
|
console.log(response1);
|
|
|
|
const response2 = await client.index({
|
|
index: "index",
|
|
id: 2,
|
|
document: {
|
|
body: "A pair of skis",
|
|
},
|
|
});
|
|
console.log(response2);
|
|
|
|
const response3 = await client.indices.refresh({
|
|
index: "index",
|
|
});
|
|
console.log(response3);
|
|
----
|