# Custom filter handler plugin

**URL:** <https://discuss.elastic.co/t/custom-filter-handler-plugin/16392>\
**Category:** Elasticsearch\
**Created:** [March 16, 2014, 10:52am UTC](https://discuss.elastic.co/t/custom-filter-handler-plugin/16392 "2014-03-16T10:52:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karol\_Gwaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karol_gwaj/32/1324_2.png) [@Karol\_Gwaj](https://discuss.elastic.co/u/Karol_Gwaj)\
**Post date:** [March 16, 2014, 10:52am UTC](https://discuss.elastic.co/t/custom-filter-handler-plugin/16392/1 "2014-03-16T10:52:44Z")

</div>

Hi,

is it possible, with current elasticsearch extensibility model, to create  
custom filter handlers ?

so i could do something like this:  
{  
"query" :  
{  
"filtered" :  
{  
"filter" :  
{

- 

```
           "my_custom_filter" : *

```

- 

```
          {*

```

- 

```
               ....*

```

- 

```
          }*
      },
      "query" : 
      {
          "match_all" : {}
      }
  }

```

}  
}

and my 'handler' will be executed only for 'my\_custom\_filter'  
so i can mix my custom filters with default elasticsearch filters

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/315ec396-634b-4198-b7eb-765a4bfb08c2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/315ec396-634b-4198-b7eb-765a4bfb08c2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [March 16, 2014, 12:46pm UTC](https://discuss.elastic.co/t/custom-filter-handler-plugin/16392/2 "2014-03-16T12:46:58Z")

</div>

In a plugin, you could either add query/filter classes per index creation,  
look at IndexQueryParserModuleTests

Or you could add programmatically query/filter classes  
to IndicesQueriesModule instance by using addQuery()/addFIlter() methods,  
which means for the whole node / all indices.

Jörg

On Sun, Mar 16, 2014 at 11:52 AM, Karol Gwaj [karol@gwaj.me](mailto:karol@gwaj.me) wrote:

> Hi,
> 
> is it possible, with current elasticsearch extensibility model, to create  
> custom filter handlers ?
> 
> so i could do something like this:  
> {  
> "query" :  
> {  
> "filtered" :  
> {  
> "filter" :  
> {
> 
> - 
> 
> ```
> "my_custom_filter" : *
> 
> ```
> 
> - 
> 
> ```
> {*
> 
> ```
> 
> - 
> 
> ```
> ....*
> 
> ```
> 
> - 
> 
> ```
> }*
> },
> "query" :
> {
> "match_all" : {}
> }
> }
> 
> ```
> 
> }  
> }
> 
> and my 'handler' will be executed only for 'my\_custom\_filter'  
> so i can mix my custom filters with default elasticsearch filters
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/315ec396-634b-4198-b7eb-765a4bfb08c2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/315ec396-634b-4198-b7eb-765a4bfb08c2%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/315ec396-634b-4198-b7eb-765a4bfb08c2%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/315ec396-634b-4198-b7eb-765a4bfb08c2%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoH2\_-j%2Bk4sQLXjfZ-Ss\_vPcXQxAMagd2krifpP%2Bu\_XWLw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoH2_-j%2Bk4sQLXjfZ-Ss_vPcXQxAMagd2krifpP%2Bu_XWLw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Karol\_Gwaj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karol_gwaj/32/1324_2.png) [@Karol\_Gwaj](https://discuss.elastic.co/u/Karol_Gwaj)\
**Post date:** [March 16, 2014, 5:29pm UTC](https://discuss.elastic.co/t/custom-filter-handler-plugin/16392/3 "2014-03-16T17:29:21Z")

</div>

thx Jörg,  
like always very helpful answer,

On Sunday, March 16, 2014 12:46:58 PM UTC, Jörg Prante wrote:

> In a plugin, you could either add query/filter classes per index creation,  
> look at IndexQueryParserModuleTests
> 
> Or you could add programmatically query/filter classes  
> to IndicesQueriesModule instance by using addQuery()/addFIlter() methods,  
> which means for the whole node / all indices.
> 
> Jörg
> 
> On Sun, Mar 16, 2014 at 11:52 AM, Karol Gwaj \<[ka...@gwaj.me](mailto:ka...@gwaj.me) \<javascript:\>\>wrote:
> 
> > Hi,
> > 
> > is it possible, with current elasticsearch extensibility model, to create  
> > custom filter handlers ?
> > 
> > so i could do something like this:  
> > {  
> > "query" :  
> > {  
> > "filtered" :  
> > {  
> > "filter" :  
> > {
> > 
> > - 
> > 
> > ```
> > "my_custom_filter" : *
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > {*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > ....*
> > 
> > ```
> > 
> > - 
> > 
> > ```
> > }*
> > },
> > "query" : 
> > {
> > "match_all" : {}
> > }
> > }
> > 
> > ```
> > 
> > }  
> > }
> > 
> > and my 'handler' will be executed only for 'my\_custom\_filter'  
> > so i can mix my custom filters with default elasticsearch filters
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/315ec396-634b-4198-b7eb-765a4bfb08c2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/315ec396-634b-4198-b7eb-765a4bfb08c2%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/315ec396-634b-4198-b7eb-765a4bfb08c2%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/315ec396-634b-4198-b7eb-765a4bfb08c2%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9bae1b8d-9c3d-467a-b0b2-2168260550dd%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9bae1b8d-9c3d-467a-b0b2-2168260550dd%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:42am UTC](https://discuss.elastic.co/t/custom-filter-handler-plugin/16392/4 "2017-07-06T01:42:57Z")

</div>


