47 lines
1.0 KiB
Plaintext
47 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: "my-index-000001",
|
|
settings: {
|
|
analysis: {
|
|
analyzer: {
|
|
my_custom_analyzer: {
|
|
char_filter: ["emoticons"],
|
|
tokenizer: "punctuation",
|
|
filter: ["lowercase", "english_stop"],
|
|
},
|
|
},
|
|
tokenizer: {
|
|
punctuation: {
|
|
type: "pattern",
|
|
pattern: "[ .,!?]",
|
|
},
|
|
},
|
|
char_filter: {
|
|
emoticons: {
|
|
type: "mapping",
|
|
mappings: [":) => _happy_", ":( => _sad_"],
|
|
},
|
|
},
|
|
filter: {
|
|
english_stop: {
|
|
type: "stop",
|
|
stopwords: "_english_",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
});
|
|
console.log(response);
|
|
|
|
const response1 = await client.indices.analyze({
|
|
index: "my-index-000001",
|
|
analyzer: "my_custom_analyzer",
|
|
text: "I'm a :) person, and you?",
|
|
});
|
|
console.log(response1);
|
|
----
|