Files
elasticsearch-js/docs/doc_examples/4cdcc3fde5cea165a3a7567962b9bd61.asciidoc
2024-07-29 17:10:05 -05:00

65 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.synonyms.putSynonym({
id: "my-synonyms-set",
synonyms_set: [
{
id: "test-1",
synonyms: "hello, hi",
},
],
});
console.log(response);
const response1 = await client.indices.create({
index: "test-index",
settings: {
analysis: {
filter: {
synonyms_filter: {
type: "synonym_graph",
synonyms_set: "my-synonyms-set",
updateable: true,
},
},
analyzer: {
my_index_analyzer: {
type: "custom",
tokenizer: "standard",
filter: ["lowercase"],
},
my_search_analyzer: {
type: "custom",
tokenizer: "standard",
filter: ["lowercase", "synonyms_filter"],
},
},
},
},
mappings: {
properties: {
title: {
type: "text",
analyzer: "my_index_analyzer",
search_analyzer: "my_search_analyzer",
},
},
},
});
console.log(response1);
const response2 = await client.synonyms.putSynonym({
id: "my-synonyms-set",
synonyms_set: [
{
id: "test-1",
synonyms: "hello, hi, howdy",
},
],
});
console.log(response2);
----