Block index creation?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Block index creation?

Andrej
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

--
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Block index creation?

Radu Gheorghe-2
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] http://www.elasticsearch.org/guide/reference/mapping/dynamic-mapping.html

Best regards,
Radu
--
http://sematext.com/ -- ElasticSearch -- Solr -- Lucene

On Fri, Nov 9, 2012 at 3:49 PM, Andrej Rosenheinrich
<[hidden email]> 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
>
> --
>
>

--


Reply | Threaded
Open this post in threaded view
|

Re: Block index creation?

choudharynarendra
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 elastic search using the couch db (integrating the couch db with elastic search) 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 <[hidden email]> 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] http://www.elasticsearch.org/guide/reference/mapping/dynamic-mapping.html

Best regards,
Radu
--
http://sematext.com/ -- ElasticSearch -- Solr -- Lucene

On Fri, Nov 9, 2012 at 3:49 PM, Andrej Rosenheinrich
<[hidden email]> 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
>
> --
>
>

--



--
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Block index creation?

simonw-2
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 elastic search using the couch db (integrating the couch db with elastic search) 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 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="g6718A94hkMJ">radu.g...@...> 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] http://www.elasticsearch.org/guide/reference/mapping/dynamic-mapping.html

Best regards,
Radu
--
http://sematext.com/ -- ElasticSearch -- Solr -- Lucene

On Fri, Nov 9, 2012 at 3:49 PM, Andrej Rosenheinrich
<<a href="javascript:" target="_blank" gdf-obfuscated-mailto="g6718A94hkMJ">andrej.ros...@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
>
> --
>
>

--



--
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Block index creation?

Andrej
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?

--