# Block index creation?

**URL:** <https://discuss.elastic.co/t/block-index-creation/9648>\
**Category:** Elasticsearch\
**Created:** [November 9, 2012, 1:49pm UTC](https://discuss.elastic.co/t/block-index-creation/9648 "2012-11-09T13:49:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrej](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@Andrej](https://discuss.elastic.co/u/Andrej)\
**Post date:** [November 9, 2012, 1:49pm UTC](https://discuss.elastic.co/t/block-index-creation/9648/1 "2012-11-09T13:49:56Z")

</div>

Hi,

probably a simple question, I couldnt find anything in the update settings  
api: I can block writing or reading, but is there a way to allow writing  
and reading on a cluster but block creation of new indices? If this is not  
possible yet, wouldnt it be a nice to have feature? 😉

Thanks!  
Andrej

--

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [November 10, 2012, 11:45am UTC](https://discuss.elastic.co/t/block-index-creation/9648/2 "2012-11-10T11:45:13Z")

</div>

Hello Andrej,

I didn't come across a situation where I needed that. For me, the only  
thing that came close was what I consider a more restrictive approach  
of disabling dynamic mapping[0]:

# grep "index.mapper.dynamic" /etc/elasticsearch/elasticsearch.yml

index.mapper.dynamic: false

In this case one wouldn't be allowed to write a document which  
contains a field that is not mapped. So you can put an index manually  
if you want:

# curl -XPUT localhost:9200/testing

{"ok":true,"acknowledged":true}

But you can't "accidentally" index a document in it:

# curl -XPUT localhost:9200/testing/test/1 -d '{"foo":"bar"}'

{"error":"TypeMissingException[[testing] type[test] missing: trying to  
auto create mapping, but dynamic mapping is disabled]","status":404}

Unless you explicitly create a mapping:

# curl -XPUT localhost:9200/testing/test/\_mapping -d

'{"properties":{"foo":{"type":"string"}}}'  
{"ok":true,"acknowledged":true}

# curl -XPUT localhost:9200/testing/test/1 -d '{"foo":"bar"}'

{"ok":true,"\_index":"testing","\_type":"test","\_id":"1","\_version":1}

If this doesn't help in your usecase, then I can't think of something  
closer. So it would be a nice to have feature, if you need it 🙂  
Although I don't know why you need that. Can you share?

[0] [Elastic — The Search AI Company | Elastic](http://www.elasticsearch.org/guide/reference/mapping/dynamic-mapping.html)

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

On Fri, Nov 9, 2012 at 3:49 PM, Andrej Rosenheinrich  
[andrej.rosenheinrich@unister.de](mailto:andrej.rosenheinrich@unister.de) wrote:

> Hi,
> 
> probably a simple question, I couldnt find anything in the update settings  
> api: I can block writing or reading, but is there a way to allow writing and  
> reading on a cluster but block creation of new indices? If this is not  
> possible yet, wouldnt it be a nice to have feature? 😉
> 
> Thanks!  
> Andrej
> 
> --

--

---

<div class="post-metadata">

**Author:** ![choudharynarendra](https://avatars.discourse-cdn.com/v4/letter/c/dbc845/32.png) [@choudharynarendra](https://discuss.elastic.co/u/choudharynarendra)\
**Post date:** [November 10, 2012, 11:09pm UTC](https://discuss.elastic.co/t/block-index-creation/9648/3 "2012-11-10T23:09:54Z")

</div>

Hi ,

When i am creating the index and my own dynamic mapping and more over i am  
put index.mapper.dynamic to false .  
But when i am creating the river plugin for the Elasticsearch using the  
couch db (integrating the couch db with Elasticsearch) then my mapping  
gioet overridden by the couch river integration ie it will create the  
default index based on my document. and that's does not i want.

Please you please suggest where i am doing wrong.

Thanks  
Narendra  
On Sat, Nov 10, 2012 at 5:15 PM, Radu Gheorghe  
[radu.gheorghe@sematext.com](mailto:radu.gheorghe@sematext.com)wrote:

> Hello Andrej,
> 
> I didn't come across a situation where I needed that. For me, the only  
> thing that came close was what I consider a more restrictive approach  
> of disabling dynamic mapping[0]:
> 
> # grep "index.mapper.dynamic" /etc/elasticsearch/elasticsearch.yml
> 
> index.mapper.dynamic: false
> 
> In this case one wouldn't be allowed to write a document which  
> contains a field that is not mapped. So you can put an index manually  
> if you want:
> 
> # curl -XPUT localhost:9200/testing
> 
> {"ok":true,"acknowledged":true}
> 
> But you can't "accidentally" index a document in it:
> 
> # curl -XPUT localhost:9200/testing/test/1 -d '{"foo":"bar"}'
> 
> {"error":"TypeMissingException[[testing] type[test] missing: trying to  
> auto create mapping, but dynamic mapping is disabled]","status":404}
> 
> Unless you explicitly create a mapping:
> 
> # curl -XPUT localhost:9200/testing/test/\_mapping -d
> 
> '{"properties":{"foo":{"type":"string"}}}'  
> {"ok":true,"acknowledged":true}
> 
> # curl -XPUT localhost:9200/testing/test/1 -d '{"foo":"bar"}'
> 
> {"ok":true,"\_index":"testing","\_type":"test","\_id":"1","\_version":1}
> 
> If this doesn't help in your usecase, then I can't think of something  
> closer. So it would be a nice to have feature, if you need it 🙂  
> Although I don't know why you need that. Can you share?
> 
> [0]  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/dynamic-mapping.html)
> 
> ## Best regards, Radu
> 
> [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> 
> On Fri, Nov 9, 2012 at 3:49 PM, Andrej Rosenheinrich  
> [andrej.rosenheinrich@unister.de](mailto:andrej.rosenheinrich@unister.de) wrote:
> 
> > Hi,
> > 
> > probably a simple question, I couldnt find anything in the update  
> > settings  
> > api: I can block writing or reading, but is there a way to allow writing  
> > and  
> > reading on a cluster but block creation of new indices? If this is not  
> > possible yet, wouldnt it be a nice to have feature? 😉
> > 
> > Thanks!  
> > Andrej
> > 
> > --
> 
> --

--

---

<div class="post-metadata">

**Author:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [November 12, 2012, 8:48am UTC](https://discuss.elastic.co/t/block-index-creation/9648/4 "2012-11-12T08:48:27Z")

</div>

I am not sure if that helps in your situation but if you set "action.auto\_create\_index:  
0 " in your elasticsearch.yml you prevent automatic index creation when  
updates / deletes come in. Maybe this helps in your situation?

simon

On Sunday, November 11, 2012 12:09:59 AM UTC+1, narendra choudhary wrote:

> Hi ,
> 
> When i am creating the index and my own dynamic mapping and more over i am  
> put index.mapper.dynamic to false .  
> But when i am creating the river plugin for the Elasticsearch using the  
> couch db (integrating the couch db with Elasticsearch) then my mapping  
> gioet overridden by the couch river integration ie it will create the  
> default index based on my document. and that's does not i want.
> 
> Please you please suggest where i am doing wrong.
> 
> Thanks  
> Narendra  
> On Sat, Nov 10, 2012 at 5:15 PM, Radu Gheorghe \<[radu.g...@sematext.com](mailto:radu.g...@sematext.com)\<javascript:\>
> 
> > wrote:
> 
> > Hello Andrej,
> > 
> > I didn't come across a situation where I needed that. For me, the only  
> > thing that came close was what I consider a more restrictive approach  
> > of disabling dynamic mapping[0]:
> > 
> > # grep "index.mapper.dynamic" /etc/elasticsearch/elasticsearch.yml
> > 
> > index.mapper.dynamic: false
> > 
> > In this case one wouldn't be allowed to write a document which  
> > contains a field that is not mapped. So you can put an index manually  
> > if you want:
> > 
> > # curl -XPUT localhost:9200/testing
> > 
> > {"ok":true,"acknowledged":true}
> > 
> > But you can't "accidentally" index a document in it:
> > 
> > # curl -XPUT localhost:9200/testing/test/1 -d '{"foo":"bar"}'
> > 
> > {"error":"TypeMissingException[[testing] type[test] missing: trying to  
> > auto create mapping, but dynamic mapping is disabled]","status":404}
> > 
> > Unless you explicitly create a mapping:
> > 
> > # curl -XPUT localhost:9200/testing/test/\_mapping -d
> > 
> > '{"properties":{"foo":{"type":"string"}}}'  
> > {"ok":true,"acknowledged":true}
> > 
> > # curl -XPUT localhost:9200/testing/test/1 -d '{"foo":"bar"}'
> > 
> > {"ok":true,"\_index":"testing","\_type":"test","\_id":"1","\_version":1}
> > 
> > If this doesn't help in your usecase, then I can't think of something  
> > closer. So it would be a nice to have feature, if you need it 🙂  
> > Although I don't know why you need that. Can you share?
> > 
> > [0]  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/dynamic-mapping.html)
> > 
> > ## Best regards, Radu
> > 
> > [http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene
> > 
> > On Fri, Nov 9, 2012 at 3:49 PM, Andrej Rosenheinrich  
> > \<[andrej.ros...@unister.de](mailto:andrej.ros...@unister.de) \<javascript:\>\> wrote:
> > 
> > > Hi,
> > > 
> > > probably a simple question, I couldnt find anything in the update  
> > > settings  
> > > api: I can block writing or reading, but is there a way to allow  
> > > writing and  
> > > reading on a cluster but block creation of new indices? If this is not  
> > > possible yet, wouldnt it be a nice to have feature? 😉
> > > 
> > > Thanks!  
> > > Andrej
> > > 
> > > --
> > 
> > --

--

---

<div class="post-metadata">

**Author:** ![Andrej](https://avatars.discourse-cdn.com/v4/letter/a/d9b06d/32.png) [@Andrej](https://discuss.elastic.co/u/Andrej)\
**Post date:** [November 12, 2012, 10:19am UTC](https://discuss.elastic.co/t/block-index-creation/9648/5 "2012-11-12T10:19:09Z")

</div>

Thanks for your suggestions so far, unfortunatly it doesnt solve my problem  
(nethertheless I learned some interesting things). One use case is pretty  
simple: to avoid human errors. Every once in a while someone is running a  
test case forgetting about client configuration, creating new test indices  
on a production system instead on a test machine. This could mean a lot of  
shard relocation and so on, effects everyone would like to avoid on a  
productive cluster. As we add some new values to our data from time to time  
disabling dynamic mapping aint really a solution. Same with  
auto\_create\_index, in test cases you could create an index by hand, so it  
wouldnt help. But while creating an index is common in testing I would  
consider something like blocking read/write/creation operations as  
administrative task not every user would/should do. So this would add an  
additional level of error preventing to my cluster.

Does that make sense and is there any way to achieve this?

--

---

<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, 3:04am UTC](https://discuss.elastic.co/t/block-index-creation/9648/6 "2017-07-06T03:04:49Z")

</div>


