# Plugin to override indexing/deleting

**URL:** <https://discuss.elastic.co/t/plugin-to-override-indexing-deleting/34501>\
**Category:** Elasticsearch\
**Created:** [November 13, 2015, 10:39am UTC](https://discuss.elastic.co/t/plugin-to-override-indexing-deleting/34501 "2015-11-13T10:39:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guilhem\_Legal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guilhem_legal/32/1843_2.png) [@Guilhem\_Legal](https://discuss.elastic.co/u/Guilhem_Legal)\
**Post date:** [November 13, 2015, 10:39am UTC](https://discuss.elastic.co/t/plugin-to-override-indexing-deleting/34501/1 "2015-11-13T10:39:12Z")

</div>

Hi!  
I'd like to write a ES plugin which allow me to write an additional file containing information about a document.

I'm currently indexing document with spatial boundaries(polygons). for each document i'm indexing, i'd like to insert this boundary in a custom R-Tree file (and remove it from the file when the document is deleted).  
I used to do it directly with lucene, but now we move to ElasticSearch for cloud purpose.

I already have an ES plugin adding a Lucene Filter which read the file and perform a spatial search.

What i want is i to write my R-tree file for each shard, containing the spatial boundary of all the document in this shard,  
In order to distribute my spatial search on each shard. I also like that when a shard is replicated, my file be replicated too.

I explored a lot of custom plugins and didn't find any way to do that. how can i :  
override the indexWriter ?  
add additional code at index/remove time?

thank's in advance  
Guilhem Legal

---

<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 5, 2017, 11:38pm UTC](https://discuss.elastic.co/t/plugin-to-override-indexing-deleting/34501/2 "2017-07-05T23:38:39Z")

</div>

Closed on July 5, 2017, 11:38pm UTC


