I am new to elasticsearch, I want to convert the text data in my 'Body' column to lowercase. I used the code below and it's not working:
{
"tokenizer": "lowercase",
"text": questionlist[current].Body
}
I want to know the right syntax to convert it to lowercase and also I want to assign the converted text to a variable 'Body'.
I tried it in 2 ways. firstly, I used it in the bulk.push() API where I load my json data and assign it to a variable. Secondly, I created a new file called preprocess.js in client.indices.create() and used it there along with the mapping (code I used in 2nd method is written below and is taken from a blog). Both the ways are not working and I don't know what I am missing.
client.indices.create({
index: 'question',
type: 'abcd',
body:{
settings:{
analysis:{
"analyzer": {
"simpleAnalyzer": {
"type": "custom",
"char_filter": [
"html_strip"
],
"tokenizer": "standard",
"filter": "lowercase"
}
}
}
}
},
mappings:{
dynamic: "true",
properties:{
'Id': {
'type': 'long', // type is a required attribute if index is specified
'index': 'not_analyzed'
},
'Body':{
'type': 'text',
'index_analyzer': 'simpleAnalyzer'
});
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.