I have some data and I have to apply similarity module on it in settings part. I did that in Node.Js
I sent data to Elasticsearch Kibana with Bulk API but similarity module is not working.
I need help like how to integrate those things in nodes.
I'm attaching the code. Please see and help...
const { Client } = require('@elastic/elasticsearch')
const client = new Client({
node: 'http://localhost:9200'
})
async function run () {
await client.indices.create({
index: 'resources',
body: {
"settings": {
"index": {
"similarity": {
"my_similarity": {
"type": "DFR",
"basic_model": "g",
"after_effect": "l",
"normalization": "h2",
"normalization.h2.c": "3.0"
}
}
},
"analysis": {
"analyzer": {
"my_custom_analyzer": {
"type": "custom",
"char_filter": ["html_strip"],
"tokenizer": "standard",
"filter": [
"lowercase",
"stop",
"asciifolding"
]
}
}
},
},
mappings: {
properties: {
id: { type: 'text' , similarity : "my_similarity"},
title: { type: 'text' , similarity : "my_similarity"},
shortDescription: { type: 'text',similarity : "my_similarity" },
description: { type: 'text',similarity : "my_similarity", analyzer:"my_custom_analyzer" }
}
}
}
}, { ignore: [400] })