# NPE on indices.admin().indices().exists() operation

**URL:** <https://discuss.elastic.co/t/npe-on-indices-admin-indices-exists-operation/12987>\
**Category:** Elasticsearch\
**Created:** [July 29, 2013, 3:45pm UTC](https://discuss.elastic.co/t/npe-on-indices-admin-indices-exists-operation/12987 "2013-07-29T15:45:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinicius\_Carvalho](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinicius_carvalho/32/770_2.png) [@Vinicius\_Carvalho](https://discuss.elastic.co/u/Vinicius_Carvalho)\
**Post date:** [July 29, 2013, 3:45pm UTC](https://discuss.elastic.co/t/npe-on-indices-admin-indices-exists-operation/12987/1 "2013-07-29T15:45:37Z")

</div>

Hi there. I'm building a plugin that as part of its initialization it  
creates an special index if one is not present. It seems though that the  
admin operations are still not ready by the time I have my plugin started.  
So I put this piece of code in one of the components of the plugin that is  
created by the plugin's module.

Code can be found  
here: [https://gist.github.com/viniciusccarvalho/d27aa2b5aaf8dd8eb9d0](https://gist.github.com/viniciusccarvalho/d27aa2b5aaf8dd8eb9d0)

If this is not the right place to create an index, where should I put this  
code? I did noticed that my plugin is started before other services in ES.

Regards

--  
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:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [July 29, 2013, 6:34pm UTC](https://discuss.elastic.co/t/npe-on-indices-admin-indices-exists-operation/12987/2 "2013-07-29T18:34:02Z")

</div>

ES starts all plugins before node startup and completion of recovery.

Run your plugin in a separate thread, and wait for cluster state 'green'  
(or 'yellow') before creating an index.

Jörg

On Mon, Jul 29, 2013 at 5:45 PM, Vinicius Carvalho \<  
[viniciusccarvalho@gmail.com](mailto:viniciusccarvalho@gmail.com)\> wrote:

> Hi there. I'm building a plugin that as part of its initialization it  
> creates an special index if one is not present. It seems though that the  
> admin operations are still not ready by the time I have my plugin started.  
> So I put this piece of code in one of the components of the plugin that is  
> created by the plugin's module.
> 
> Code can be found here:  
> [Replicator · GitHub](https://gist.github.com/viniciusccarvalho/d27aa2b5aaf8dd8eb9d0)
> 
> If this is not the right place to create an index, where should I put this  
> code? I did noticed that my plugin is started before other services in ES.
> 
> Regards
> 
> --  
> 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).

--  
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:23am UTC](https://discuss.elastic.co/t/npe-on-indices-admin-indices-exists-operation/12987/3 "2017-07-06T02:23:58Z")

</div>


