65 lines
1.3 KiB
Plaintext
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);
|
|
----
|