# Can analyzer used in bulk API?

**URL:** https://discuss.elastic.co/t/can-analyzer-used-in-bulk-api/3746
**Category:** Elasticsearch
**Created:** [January 5, 2011, 11:21am UTC](https://discuss.elastic.co/t/can-analyzer-used-in-bulk-api/3746 "2011-01-05T11:21:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Sam\_4](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@Sam\_4](https://discuss.elastic.co/u/Sam_4)
#### Post date: [January 5, 2011, 11:21am UTC](https://discuss.elastic.co/t/can-analyzer-used-in-bulk-api/3746/1 "2011-01-05T11:21:16Z")

</div>

Could the analyzer be passed with the index and bulk api?

Thanks

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [January 5, 2011, 12:26pm UTC](https://discuss.elastic.co/t/can-analyzer-used-in-bulk-api/3746/2 "2011-01-05T12:26:50Z")

</div>

No, you can use the analyzer mapping to control it from a field within the  
indexed doc.

On Wed, Jan 5, 2011 at 1:21 PM, sam [mishra.sameek@gmail.com](mailto:mishra.sameek@gmail.com) wrote:

> Could the analyzer be passed with the index and bulk api?
> 
> Thanks

---

<div class="post-metadata">

### Author: ![Sam\_4](https://avatars.discourse-cdn.com/v4/letter/s/db5fbb/32.png) [@Sam\_4](https://discuss.elastic.co/u/Sam_4)
#### Post date: [January 10, 2011, 5:49am UTC](https://discuss.elastic.co/t/can-analyzer-used-in-bulk-api/3746/3 "2011-01-10T05:49:30Z")

</div>

I am using Rabbitmq River,The format of the messages follows the bulk  
API format using Java:

String message= " {"index" : { "\_index" : "test", "\_type" :  
"type1", "\_id" : "2" } }\n"+  
" {"id":"first","keyword":"rabin  
"}"

I want to add analyzer in field id and keyword,for that i am using  
below following Explicit mappings:

String message=" {"index" : { "\_index" : "test", "\_type" :  
"type1", "\_id" : "2" } }\n"+  
"{"type1" : { "properties": {"id":  
{"type":"string","index":"analyzed"},"keyword":{"type":  
"string","index":"analyzed"}}}}\n"+  
" {"id":"first","keyword":"rabin"}"

This settings is not working.what should be the correct mapping for  
applying analyzer to the index.

Thanks

On Jan 5, 5:26 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> No, you can use the analyzer mapping to control it from a field within the  
> indexed doc.
> 
> On Wed, Jan 5, 2011 at 1:21 PM, sam [mishra.sam...@gmail.com](mailto:mishra.sam...@gmail.com) wrote:
> 
> > Could the analyzer be passed with the index and bulk api?
> 
> > Thanks

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [January 10, 2011, 3:22pm UTC](https://discuss.elastic.co/t/can-analyzer-used-in-bulk-api/3746/4 "2011-01-10T15:22:39Z")

</div>

You need to predefine the mapping using the put mapping API, and then start indexing. I suggest you give it a go using simple curl requests, and then you can test with the bulk api.  
On Monday, January 10, 2011 at 7:49 AM, sam wrote:

> I am using Rabbitmq River,The format of the messages follows the bulk  
> API format using Java:
> 
> String message= " {"index" : { "\_index" : "test", "\_type" :  
> "type1", "\_id" : "2" } }\n"+  
> " {"id":"first","keyword":"rabin  
> "}"
> 
> I want to add analyzer in field id and keyword,for that i am using  
> below following Explicit mappings:
> 
> String message=" {"index" : { "\_index" : "test", "\_type" :  
> "type1", "\_id" : "2" } }\n"+  
> "{"type1" : { "properties": {"id":  
> {"type":"string","index":"analyzed"},"keyword":{"type":  
> "string","index":"analyzed"}}}}\n"+  
> " {"id":"first","keyword":"rabin"}"
> 
> This settings is not working.what should be the correct mapping for  
> applying analyzer to the index.
> 
> Thanks
> 
> On Jan 5, 5:26 pm, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > No, you can use the analyzer mapping to control it from a field within the  
> > indexed doc.
> > 
> > On Wed, Jan 5, 2011 at 1:21 PM, sam [mishra.sam...@gmail.com](mailto:mishra.sam...@gmail.com) wrote:
> > 
> > > Could the analyzer be passed with the index and bulk api?
> > 
> > > Thanks

---

<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: [July 6, 2017, 4:14am UTC](https://discuss.elastic.co/t/can-analyzer-used-in-bulk-api/3746/5 "2017-07-06T04:14:05Z")

</div>


