# Extension Point for Custom Lucene Collectors?

**URL:** <https://discuss.elastic.co/t/extension-point-for-custom-lucene-collectors/8501>\
**Category:** Elasticsearch\
**Created:** [July 24, 2012, 11:54am UTC](https://discuss.elastic.co/t/extension-point-for-custom-lucene-collectors/8501 "2012-07-24T11:54:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![davrob](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@davrob](https://discuss.elastic.co/u/davrob)\
**Post date:** [July 24, 2012, 11:54am UTC](https://discuss.elastic.co/t/extension-point-for-custom-lucene-collectors/8501/1 "2012-07-24T11:54:41Z")

</div>

Hi,

I would like to use a custom org.apache.lucene.search.TopFieldCollector in  
my searches. Does ES have an extension point where I can do this?

- David.

---

<div class="post-metadata">

**Author:** ![Ferhat\_Celik](https://avatars.discourse-cdn.com/v4/letter/f/ee7513/32.png) [@Ferhat\_Celik](https://discuss.elastic.co/u/Ferhat_Celik)\
**Post date:** [July 30, 2012, 8:22am UTC](https://discuss.elastic.co/t/extension-point-for-custom-lucene-collectors/8501/2 "2012-07-30T08:22:38Z")

</div>

I also got this problem. I've already have an implemented custom collector  
for lucene, but i don't know how to use in Elasticsearch...

On Tuesday, July 24, 2012 2:54:41 PM UTC+3, davrob2 wrote:

> Hi,
> 
> I would like to use a custom org.apache.lucene.search.TopFieldCollector in  
> my searches. Does ES have an extension point where I can do this?
> 
> - David.

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [July 30, 2012, 4:26pm UTC](https://discuss.elastic.co/t/extension-point-for-custom-lucene-collectors/8501/3 "2012-07-30T16:26:15Z")

</div>

You can register the custom collector as a plugin. However, the  
collector is simply not plug-n-play, it needs to conform with the  
distributed nature of Elasticsearch and implement the appropriate  
classes.

Here is a previous discussion:  
[http://elasticsearch-users.115913.n3.nabble.com/Creating-new-facet-types-td3745543.html](http://elasticsearch-users.115913.n3.nabble.com/Creating-new-facet-types-td3745543.html)

--  
Ivan

On Mon, Jul 30, 2012 at 1:22 AM, Ferhat Celik [ceferhat@gmail.com](mailto:ceferhat@gmail.com) wrote:

> I also got this problem. I've already have an implemented custom collector  
> for lucene, but i don't know how to use in Elasticsearch...
> 
> On Tuesday, July 24, 2012 2:54:41 PM UTC+3, davrob2 wrote:
> 
> > Hi,
> > 
> > I would like to use a custom org.apache.lucene.search.TopFieldCollector in  
> > my searches. Does ES have an extension point where I can do this?
> > 
> > - David.

---

<div class="post-metadata">

**Author:** ![davrob](https://avatars.discourse-cdn.com/v4/letter/d/d78d45/32.png) [@davrob](https://discuss.elastic.co/u/davrob)\
**Post date:** [August 6, 2012, 10:28am UTC](https://discuss.elastic.co/t/extension-point-for-custom-lucene-collectors/8501/4 "2012-08-06T10:28:46Z")

</div>

Hi Ivan,

Thanks for the advice. I want to create a custom sort plugin that will  
allow custom sorting by comparator, rather than by score, which will  
require some map-reduce style work to gather the sort results from each  
shard and then combine the results into a final sort order.

This is quite worrying stuff, as there is a lot that could go wrong, any  
clues and pointers you can give would be valuable.

So far, this custom facet seems like the best example I could use, as  
facets also have to use map-reduce to collect their data:

[https://github.com/jprante/elasticsearch-index-termlist/blob/master/src/main/java/org/elasticsearch/action/termlist/TransportTermlistAction.java](https://github.com/jprante/elasticsearch-index-termlist/blob/master/src/main/java/org/elasticsearch/action/termlist/TransportTermlistAction.java)

Any other links would be welcome.

- David.

On Monday, July 30, 2012 5:26:15 PM UTC+1, Ivan Brusic wrote:

> You can register the custom collector as a plugin. However, the  
> collector is simply not plug-n-play, it needs to conform with the  
> distributed nature of Elasticsearch and implement the appropriate  
> classes.
> 
> Here is a previous discussion:
> 
> [http://elasticsearch-users.115913.n3.nabble.com/Creating-new-facet-types-td3745543.html](http://elasticsearch-users.115913.n3.nabble.com/Creating-new-facet-types-td3745543.html)
> 
> --  
> Ivan
> 
> On Mon, Jul 30, 2012 at 1:22 AM, Ferhat Celik [ceferhat@gmail.com](mailto:ceferhat@gmail.com) wrote:
> 
> > I also got this problem. I've already have an implemented custom  
> > collector  
> > for lucene, but i don't know how to use in Elasticsearch...
> > 
> > On Tuesday, July 24, 2012 2:54:41 PM UTC+3, davrob2 wrote:
> > 
> > > Hi,
> > > 
> > > I would like to use a custom org.apache.lucene.search.TopFieldCollector  
> > > in  
> > > my searches. Does ES have an extension point where I can do this?
> > > 
> > > - David.

---

<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:17am UTC](https://discuss.elastic.co/t/extension-point-for-custom-lucene-collectors/8501/5 "2017-07-06T03:17:39Z")

</div>


