# Implementing Lowercase tokenizer

**URL:** <https://discuss.elastic.co/t/implementing-lowercase-tokenizer/117794>\
**Category:** Elasticsearch\
**Created:** [January 31, 2018, 11:30am UTC](https://discuss.elastic.co/t/implementing-lowercase-tokenizer/117794 "2018-01-31T11:30:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![incognito](https://avatars.discourse-cdn.com/v4/letter/i/b9bd4f/32.png) [@incognito](https://discuss.elastic.co/u/incognito)\
**Post date:** [January 31, 2018, 11:30am UTC](https://discuss.elastic.co/t/implementing-lowercase-tokenizer/117794/1 "2018-01-31T11:30:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 2, 2018, 12:31am UTC](https://discuss.elastic.co/t/implementing-lowercase-tokenizer/117794/2 "2018-02-02T00:31:20Z")

</div>

Where did you use that code?

---

<div class="post-metadata">

**Author:** ![incognito](https://avatars.discourse-cdn.com/v4/letter/i/b9bd4f/32.png) [@incognito](https://discuss.elastic.co/u/incognito)\
**Post date:** [February 5, 2018, 4:05am UTC](https://discuss.elastic.co/t/implementing-lowercase-tokenizer/117794/3 "2018-02-05T04:05:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 5, 2018, 4:05am UTC](https://discuss.elastic.co/t/implementing-lowercase-tokenizer/117794/4 "2018-03-05T04:05:44Z")

</div>

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