82 lines
1.3 KiB
Plaintext
82 lines
1.3 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: {
|
|
normalizer: {
|
|
my_normalizer: {
|
|
type: "custom",
|
|
char_filter: [],
|
|
filter: ["lowercase", "asciifolding"],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
mappings: {
|
|
properties: {
|
|
foo: {
|
|
type: "keyword",
|
|
normalizer: "my_normalizer",
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
|
|
const response1 = await client.index({
|
|
index: "index",
|
|
id: 1,
|
|
document: {
|
|
foo: "BÀR",
|
|
},
|
|
});
|
|
console.log(response1);
|
|
|
|
const response2 = await client.index({
|
|
index: "index",
|
|
id: 2,
|
|
document: {
|
|
foo: "bar",
|
|
},
|
|
});
|
|
console.log(response2);
|
|
|
|
const response3 = await client.index({
|
|
index: "index",
|
|
id: 3,
|
|
document: {
|
|
foo: "baz",
|
|
},
|
|
});
|
|
console.log(response3);
|
|
|
|
const response4 = await client.indices.refresh({
|
|
index: "index",
|
|
});
|
|
console.log(response4);
|
|
|
|
const response5 = await client.search({
|
|
index: "index",
|
|
query: {
|
|
term: {
|
|
foo: "BAR",
|
|
},
|
|
},
|
|
});
|
|
console.log(response5);
|
|
|
|
const response6 = await client.search({
|
|
index: "index",
|
|
query: {
|
|
match: {
|
|
foo: "BAR",
|
|
},
|
|
},
|
|
});
|
|
console.log(response6);
|
|
----
|