Implementing Lowercase tokenizer


#1

Hi,

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'.

Thanks,
Faustina


(Mark Walkom) #2

Where did you use that code?


#3

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'
});


(system) #4

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