# Indexing with Bulk API

**URL:** <https://discuss.elastic.co/t/indexing-with-bulk-api/10640>\
**Category:** Elasticsearch\
**Created:** [February 6, 2013, 4:58pm UTC](https://discuss.elastic.co/t/indexing-with-bulk-api/10640 "2013-02-06T16:58:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pierre\_De\_Soyres](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@Pierre\_De\_Soyres](https://discuss.elastic.co/u/Pierre_De_Soyres)\
**Post date:** [February 6, 2013, 4:58pm UTC](https://discuss.elastic.co/t/indexing-with-bulk-api/10640/1 "2013-02-06T16:58:19Z")

</div>

Hi,

I am indexing some items using Bulk API and using the folowing binary  
content :

{ "index" : { "\_index" : "test", "\_type" : "type1", "\_id" : "1" } }  
{ "field1" : "value1" }

If the index 'test' and/or the mapping 'type1', don't exist in my server,  
it is automatically created  
Then, an item with id '1' is indexed with { "field1" : "value1" } source.

How could I have an error if the index and/or the mapping don't exist ? In  
other words, how could I tell the server not to create automatically the  
index/mapping if the don't exist ?

Pierre

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [February 6, 2013, 5:04pm UTC](https://discuss.elastic.co/t/indexing-with-bulk-api/10640/2 "2013-02-06T17:04:40Z")

</div>

> How could I have an error if the index and/or the mapping don't  
> exist ? In other words, how could I tell the server not to create  
> automatically the index/mapping if the don't exist ?

Add this to your config/elasticsearch.yml:

action.auto\_create\_index: 0  
index.mapper.dynamic: 0

clint

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dakrone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dakrone/32/23351_2.png) [@dakrone](https://discuss.elastic.co/u/dakrone)\
**Post date:** [February 6, 2013, 5:04pm UTC](https://discuss.elastic.co/t/indexing-with-bulk-api/10640/3 "2013-02-06T17:04:54Z")

</div>

Pierre De Soyres writes:

> Hi,
> 
> I am indexing some items using Bulk API and using the folowing binary  
> content :
> 
> { "index" : { "\_index" : "test", "\_type" : "type1", "\_id" : "1" } }  
> { "field1" : "value1" }
> 
> If the index 'test' and/or the mapping 'type1', don't exist in my server,  
> it is automatically created  
> Then, an item with id '1' is indexed with { "field1" : "value1" } source.
> 
> How could I have an error if the index and/or the mapping don't exist ? In  
> other words, how could I tell the server not to create automatically the  
> index/mapping if the don't exist ?
> 
> Pierre

Hi Pierre,

You can disallow dynamic mappings using this setting in  
elasticsearch.yml:

index.mapper.dynamic: false

;; Lee Hinman

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:52am UTC](https://discuss.elastic.co/t/indexing-with-bulk-api/10640/4 "2017-07-06T02:52:44Z")

</div>


