Mapping with nodejs

hello sir
I am using node js to index data from mongo to elastic search. I want to know how to map my index.
By using kibana or from my node application.

you need to create a mapping before you index any documents. One possibility is to supply the mapping when creating the index, the other possibility would be the use of index templates, that get automatically applied, when an index is created. I personally would favor the latter.

See https://www.elastic.co/guide/en/elasticsearch/reference/7.3/indices-templates.html

If your question is more about how mapping works in general, please take a look at https://www.elastic.co/guide/en/elasticsearch/reference/7.3/mapping.html

If there is a concrete question about your data, please supply reproducible examples, preferrably in kibana format. Thanks!

PUT ln_subject
{
"settings": {
"analysis": {
"analyzer": {
"my_analyzer":{
"type":"standard",
"stopwords": "english"
}
}
}
},
"mappings": {
"properties":{
"type":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword"
}
},
"analyzer":"my_analyzer"
},
"name":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword"
}
},
"analyzer":"my_analyzer"
},
"description":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword"
}
},
"analyzer":"my_analyzer"
},
"shortname":{
"type":"text",
"fields":{
"keyword":{
"type":"keyword"
}
},
"analyzer":"my_analyzer"
}
}
}
}
sir ,
i am using this format for mapping my data. I want to know i can map from my kibana dev console or i have to also define my mapping from my node js application.and please suggest for improvement in my mapping and importing analyzer.

you can create an index from dev console and then just index/search data on that index from your node.js app.

Again, looking at indices templates is a good idea.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.