# Custom Scorer and Custom Analyzer

**URL:** <https://discuss.elastic.co/t/custom-scorer-and-custom-analyzer/6301>\
**Category:** Elasticsearch\
**Created:** [January 6, 2012, 6:00pm UTC](https://discuss.elastic.co/t/custom-scorer-and-custom-analyzer/6301 "2012-01-06T18:00:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scott\_Decker](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@Scott\_Decker](https://discuss.elastic.co/u/Scott_Decker)\
**Post date:** [January 6, 2012, 6:00pm UTC](https://discuss.elastic.co/t/custom-scorer-and-custom-analyzer/6301/1 "2012-01-06T18:00:09Z")

</div>

Hey All,  
I had searched in the groups here for this info, but it was always  
"ping me to get info" =)

How do we go about inserting a custom scorer into elastic search  
(insert our own Similarity java object)  
How do we go about inserting a custom analyzer - much like inserting a  
custom Similarity java object.

We have a specific type of token that we are building, and we have our  
own analyzer for breaking the token up correctly, and then using the  
custom scorer to then score the matches.

I get how to do this in Lucene, just don't see how we do that in ES so  
that the Lucene indexes use these in ES.

Any help would be much appreciated

Thanks,  
Scott

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 6, 2012, 9:06pm UTC](https://discuss.elastic.co/t/custom-scorer-and-custom-analyzer/6301/2 "2012-01-06T21:06:58Z")

</div>

Custom analyzer is simple, and there are plenty of samples, here is one:  
[GitHub - elastic/elasticsearch-analysis-smartcn: Smart Chinese Analysis Plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-analysis-smartcn).

Custom similarity (not scorer, I assume?) is simple as well, just not  
documented. Here is the package where the logic resides:  
[https://github.com/elasticsearch/elasticsearch/tree/master/src/main/java/org/elasticsearch/index/similarity](https://github.com/elasticsearch/elasticsearch/tree/master/src/main/java/org/elasticsearch/index/similarity).  
You need to implement a custom SimilarityProvider (  
[https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/similarity/SimilarityProvider.java](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/similarity/SimilarityProvider.java)),  
and set it using the setting: index.similarity.index.type and  
index.similarity.search.type (this will override the default ones).

On Fri, Jan 6, 2012 at 8:00 PM, Scott Decker [scott@publishthis.com](mailto:scott@publishthis.com) wrote:

> Hey All,  
> I had searched in the groups here for this info, but it was always  
> "ping me to get info" =)
> 
> How do we go about inserting a custom scorer into Elasticsearch  
> (insert our own Similarity java object)  
> How do we go about inserting a custom analyzer - much like inserting a  
> custom Similarity java object.
> 
> We have a specific type of token that we are building, and we have our  
> own analyzer for breaking the token up correctly, and then using the  
> custom scorer to then score the matches.
> 
> I get how to do this in Lucene, just don't see how we do that in ES so  
> that the Lucene indexes use these in ES.
> 
> Any help would be much appreciated
> 
> Thanks,  
> Scott

---

<div class="post-metadata">

**Author:** ![Scott\_Decker](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@Scott\_Decker](https://discuss.elastic.co/u/Scott_Decker)\
**Post date:** [January 6, 2012, 9:54pm UTC](https://discuss.elastic.co/t/custom-scorer-and-custom-analyzer/6301/3 "2012-01-06T21:54:07Z")

</div>

Fantastic! Will go take a look and see if there is anything else we  
may run into.  
Thanks,  
Scott

On Jan 6, 1:06 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Custom analyzer is simple, and there are plenty of samples, here is one:[GitHub - elastic/elasticsearch-analysis-smartcn: Smart Chinese Analysis Plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-analysis-smartcn).
> 
> Custom similarity (not scorer, I assume?) is simple as well, just not  
> documented. Here is the package where the logic resides:[https://github.com/elasticsearch/elasticsearch/tree/master/src/main/j](https://github.com/elasticsearch/elasticsearch/tree/master/src/main/j)....  
> You need to implement a custom SimilarityProvider ([https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j)...),  
> and set it using the setting: index.similarity.index.type and  
> index.similarity.search.type (this will override the default ones).
> 
> On Fri, Jan 6, 2012 at 8:00 PM, Scott Decker [sc...@publishthis.com](mailto:sc...@publishthis.com) wrote:
> 
> > Hey All,  
> > I had searched in the groups here for this info, but it was always  
> > "ping me to get info" =)
> 
> > How do we go about inserting a custom scorer into Elasticsearch  
> > (insert our own Similarity java object)  
> > How do we go about inserting a custom analyzer - much like inserting a  
> > custom Similarity java object.
> 
> > We have a specific type of token that we are building, and we have our  
> > own analyzer for breaking the token up correctly, and then using the  
> > custom scorer to then score the matches.
> 
> > I get how to do this in Lucene, just don't see how we do that in ES so  
> > that the Lucene indexes use these in ES.
> 
> > Any help would be much appreciated
> 
> > Thanks,  
> > Scott

---

<div class="post-metadata">

**Author:** ![Scott\_Decker](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@Scott\_Decker](https://discuss.elastic.co/u/Scott_Decker)\
**Post date:** [January 9, 2012, 3:15pm UTC](https://discuss.elastic.co/t/custom-scorer-and-custom-analyzer/6301/4 "2012-01-09T15:15:27Z")

</div>

Just for everyone's future searching of the groups.  
If we did implement our own Scorer (not a Similarity Object) is it  
possible to load that into ES as well? If so, how would we do it.

I am talking about this in Lucene: org.apache.lucene.search.Scorer

Thanks,  
Scott

On Jan 6, 1:54 pm, Scott Decker [sc...@publishthis.com](mailto:sc...@publishthis.com) wrote:

> Fantastic! Will go take a look and see if there is anything else we  
> may run into.  
> Thanks,  
> Scott
> 
> On Jan 6, 1:06 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > Custom analyzer is simple, and there are plenty of samples, here is one:[GitHub - elastic/elasticsearch-analysis-smartcn: Smart Chinese Analysis Plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-analysis-smartcn).
> 
> > Custom similarity (not scorer, I assume?) is simple as well, just not  
> > documented. Here is the package where the logic resides:[https://github.com/elasticsearch/elasticsearch/tree/master/src/main/j](https://github.com/elasticsearch/elasticsearch/tree/master/src/main/j)....  
> > You need to implement a custom SimilarityProvider ([https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j)...),  
> > and set it using the setting: index.similarity.index.type and  
> > index.similarity.search.type (this will override the default ones).
> 
> > On Fri, Jan 6, 2012 at 8:00 PM, Scott Decker [sc...@publishthis.com](mailto:sc...@publishthis.com) wrote:
> > 
> > > Hey All,  
> > > I had searched in the groups here for this info, but it was always  
> > > "ping me to get info" =)
> 
> > > How do we go about inserting a custom scorer into Elasticsearch  
> > > (insert our own Similarity java object)  
> > > How do we go about inserting a custom analyzer - much like inserting a  
> > > custom Similarity java object.
> 
> > > We have a specific type of token that we are building, and we have our  
> > > own analyzer for breaking the token up correctly, and then using the  
> > > custom scorer to then score the matches.
> 
> > > I get how to do this in Lucene, just don't see how we do that in ES so  
> > > that the Lucene indexes use these in ES.
> 
> > > Any help would be much appreciated
> 
> > > Thanks,  
> > > Scott

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [January 9, 2012, 7:38pm UTC](https://discuss.elastic.co/t/custom-scorer-and-custom-analyzer/6301/5 "2012-01-09T19:38:27Z")

</div>

You can build your own custom query parser, register it with the query  
registry (it will need to know how to parse itself from a json/xcontent  
format). The query parser returns a Lucene Query which can create its  
custom scorer. The nice bit is that once you register a custom query, its  
part of the query DSL... . Its not documented how to do that, but if you  
need it, I can explain...

On Mon, Jan 9, 2012 at 5:15 PM, Scott Decker [scott@publishthis.com](mailto:scott@publishthis.com) wrote:

> Just for everyone's future searching of the groups.  
> If we did implement our own Scorer (not a Similarity Object) is it  
> possible to load that into ES as well? If so, how would we do it.
> 
> I am talking about this in Lucene: org.apache.lucene.search.Scorer
> 
> Thanks,  
> Scott
> 
> On Jan 6, 1:54 pm, Scott Decker [sc...@publishthis.com](mailto:sc...@publishthis.com) wrote:
> 
> > Fantastic! Will go take a look and see if there is anything else we  
> > may run into.  
> > Thanks,  
> > Scott
> > 
> > On Jan 6, 1:06 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > Custom analyzer is simple, and there are plenty of samples, here is  
> > > one:[GitHub - elastic/elasticsearch-analysis-smartcn: Smart Chinese Analysis Plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-analysis-smartcn).
> > 
> > > Custom similarity (not scorer, I assume?) is simple as well, just not  
> > > documented. Here is the package where the logic resides:  
> > > [https://github.com/elasticsearch/elasticsearch/tree/master/src/main/j](https://github.com/elasticsearch/elasticsearch/tree/master/src/main/j)....  
> > > You need to implement a custom SimilarityProvider (  
> > > [https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j)...),  
> > > and set it using the setting: index.similarity.index.type and  
> > > index.similarity.search.type (this will override the default ones).
> > 
> > > On Fri, Jan 6, 2012 at 8:00 PM, Scott Decker [sc...@publishthis.com](mailto:sc...@publishthis.com)  
> > > wrote:
> > > 
> > > > Hey All,  
> > > > I had searched in the groups here for this info, but it was always  
> > > > "ping me to get info" =)
> > 
> > > > How do we go about inserting a custom scorer into Elasticsearch  
> > > > (insert our own Similarity java object)  
> > > > How do we go about inserting a custom analyzer - much like inserting  
> > > > a  
> > > > custom Similarity java object.
> > 
> > > > We have a specific type of token that we are building, and we have  
> > > > our  
> > > > own analyzer for breaking the token up correctly, and then using the  
> > > > custom scorer to then score the matches.
> > 
> > > > I get how to do this in Lucene, just don't see how we do that in ES  
> > > > so  
> > > > that the Lucene indexes use these in ES.
> > 
> > > > Any help would be much appreciated
> > 
> > > > Thanks,  
> > > > Scott

---

<div class="post-metadata">

**Author:** ![Scott\_Decker](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@Scott\_Decker](https://discuss.elastic.co/u/Scott_Decker)\
**Post date:** [February 3, 2012, 7:54pm UTC](https://discuss.elastic.co/t/custom-scorer-and-custom-analyzer/6301/6 "2012-02-03T19:54:00Z")

</div>

A further question on the similarity object.  
Is there any way to set a similarity object on a per field basis?

We have special coord/idf/queryNorm/tf for one field, but all other  
fields use the default similarity.

Looks like this may not be possible with lucene? Any hacks for it to  
work in elasticsearch?

Scott

On Jan 9, 11:38 am, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> You can build your own custom query parser, register it with the query  
> registry (it will need to know how to parse itself from a json/xcontent  
> format). The query parser returns a Lucene Query which can create its  
> custom scorer. The nice bit is that once you register a custom query, its  
> part of the query DSL... . Its not documented how to do that, but if you  
> need it, I can explain...
> 
> On Mon, Jan 9, 2012 at 5:15 PM, Scott Decker [sc...@publishthis.com](mailto:sc...@publishthis.com) wrote:
> 
> > Just for everyone's future searching of the groups.  
> > If we did implement our own Scorer (not a Similarity Object) is it  
> > possible to load that into ES as well? If so, how would we do it.
> 
> > I am talking about this in Lucene: org.apache.lucene.search.Scorer
> 
> > Thanks,  
> > Scott
> 
> > On Jan 6, 1:54 pm, Scott Decker [sc...@publishthis.com](mailto:sc...@publishthis.com) wrote:
> > 
> > > Fantastic! Will go take a look and see if there is anything else we  
> > > may run into.  
> > > Thanks,  
> > > Scott
> 
> > > On Jan 6, 1:06 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > > > Custom analyzer is simple, and there are plenty of samples, here is  
> > > > one:[GitHub - elastic/elasticsearch-analysis-smartcn: Smart Chinese Analysis Plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-analysis-smartcn).
> 
> > > > Custom similarity (not scorer, I assume?) is simple as well, just not  
> > > > documented. Here is the package where the logic resides:  
> > > > [https://github.com/elasticsearch/elasticsearch/tree/master/src/main/j](https://github.com/elasticsearch/elasticsearch/tree/master/src/main/j)....  
> > > > You need to implement a custom SimilarityProvider (  
> > > > [https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j)...),  
> > > > and set it using the setting: index.similarity.index.type and  
> > > > index.similarity.search.type (this will override the default ones).
> 
> > > > On Fri, Jan 6, 2012 at 8:00 PM, Scott Decker [sc...@publishthis.com](mailto:sc...@publishthis.com)  
> > > > wrote:
> > > > 
> > > > > Hey All,  
> > > > > I had searched in the groups here for this info, but it was always  
> > > > > "ping me to get info" =)
> 
> > > > > How do we go about inserting a custom scorer into Elasticsearch  
> > > > > (insert our own Similarity java object)  
> > > > > How do we go about inserting a custom analyzer - much like inserting  
> > > > > a  
> > > > > custom Similarity java object.
> 
> > > > > We have a specific type of token that we are building, and we have  
> > > > > our  
> > > > > own analyzer for breaking the token up correctly, and then using the  
> > > > > custom scorer to then score the matches.
> 
> > > > > I get how to do this in Lucene, just don't see how we do that in ES  
> > > > > so  
> > > > > that the Lucene indexes use these in ES.
> 
> > > > > Any help would be much appreciated
> 
> > > > > Thanks,  
> > > > > Scott

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 5, 2012, 1:36pm UTC](https://discuss.elastic.co/t/custom-scorer-and-custom-analyzer/6301/7 "2012-02-05T13:36:39Z")

</div>

No, its not possible in Lucene, thought the upcoming Lucene version (currently trunk) will allow for it.

On Friday, February 3, 2012 at 9:54 PM, Scott Decker wrote:

> A further question on the similarity object.  
> Is there any way to set a similarity object on a per field basis?
> 
> We have special coord/idf/queryNorm/tf for one field, but all other  
> fields use the default similarity.
> 
> Looks like this may not be possible with lucene? Any hacks for it to  
> work in elasticsearch?
> 
> Scott
> 
> On Jan 9, 11:38 am, Shay Banon \<[kim...@gmail.com](mailto:kim...@gmail.com) ([http://gmail.com](http://gmail.com))\> wrote:
> 
> > You can build your own custom query parser, register it with the query  
> > registry (it will need to know how to parse itself from a json/xcontent  
> > format). The query parser returns a Lucene Query which can create its  
> > custom scorer. The nice bit is that once you register a custom query, its  
> > part of the query DSL... . Its not documented how to do that, but if you  
> > need it, I can explain...
> > 
> > On Mon, Jan 9, 2012 at 5:15 PM, Scott Decker \<[sc...@publishthis.com](mailto:sc...@publishthis.com) ([http://publishthis.com](http://publishthis.com))\> wrote:
> > 
> > > Just for everyone's future searching of the groups.  
> > > If we did implement our own Scorer (not a Similarity Object) is it  
> > > possible to load that into ES as well? If so, how would we do it.
> > 
> > > I am talking about this in Lucene: org.apache.lucene.search.Scorer
> > 
> > > Thanks,  
> > > Scott
> > 
> > > On Jan 6, 1:54 pm, Scott Decker \<[sc...@publishthis.com](mailto:sc...@publishthis.com) ([http://publishthis.com](http://publishthis.com))\> wrote:
> > > 
> > > > Fantastic! Will go take a look and see if there is anything else we  
> > > > may run into.  
> > > > Thanks,  
> > > > Scott
> > 
> > > > On Jan 6, 1:06 pm, Shay Banon \<[kim...@gmail.com](mailto:kim...@gmail.com) ([http://gmail.com](http://gmail.com))\> wrote:
> > 
> > > > > Custom analyzer is simple, and there are plenty of samples, here is  
> > > > > one:[GitHub - elastic/elasticsearch-analysis-smartcn: Smart Chinese Analysis Plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-analysis-smartcn).
> > 
> > > > > Custom similarity (not scorer, I assume?) is simple as well, just not  
> > > > > documented. Here is the package where the logic resides:
> > > 
> > > [https://github.com/elasticsearch/elasticsearch/tree/master/src/main/j](https://github.com/elasticsearch/elasticsearch/tree/master/src/main/j)....
> > > 
> > > > > You need to implement a custom SimilarityProvider (
> > > 
> > > [https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j)...),
> > > 
> > > > > and set it using the setting: index.similarity.index.type and  
> > > > > index.similarity.search.type (this will override the default ones).
> > 
> > > > > On Fri, Jan 6, 2012 at 8:00 PM, Scott Decker \<[sc...@publishthis.com](mailto:sc...@publishthis.com) ([http://publishthis.com](http://publishthis.com))\>  
> > > > > wrote:
> > > > > 
> > > > > > Hey All,  
> > > > > > I had searched in the groups here for this info, but it was always  
> > > > > > "ping me to get info" =)
> > 
> > > > > > How do we go about inserting a custom scorer into Elasticsearch  
> > > > > > (insert our own Similarity java object)  
> > > > > > How do we go about inserting a custom analyzer - much like inserting
> > > 
> > > a
> > > 
> > > > > > custom Similarity java object.
> > 
> > > > > > We have a specific type of token that we are building, and we have  
> > > > > > our  
> > > > > > own analyzer for breaking the token up correctly, and then using the  
> > > > > > custom scorer to then score the matches.
> > 
> > > > > > I get how to do this in Lucene, just don't see how we do that in ES  
> > > > > > so  
> > > > > > that the Lucene indexes use these in ES.
> > 
> > > > > > Any help would be much appreciated
> > 
> > > > > > Thanks,  
> > > > > > Scott

---

<div class="post-metadata">

**Author:** ![Tanguy1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tanguy1/32/1749_2.png) [@Tanguy1](https://discuss.elastic.co/u/Tanguy1)\
**Post date:** [May 30, 2012, 8:07pm UTC](https://discuss.elastic.co/t/custom-scorer-and-custom-analyzer/6301/8 "2012-05-30T20:07:22Z")

</div>

Thanks, this thread help me a lot.

Here is an example of a custom similarity provider is someone needs it:

> **[GitHub - tlrx/elasticsearch-custom-similarity-provider: A custom...](https://github.com/tlrx/elasticsearch-custom-similarity-provider)**
>
> A custom SimilarityProvider example for Elasticsearch - GitHub - tlrx/elasticsearch-custom-similarity-provider: A custom SimilarityProvider example for Elasticsearch

-- Tanguy  
Twitter: @tlrx

Le vendredi 6 janvier 2012 22:06:58 UTC+1, kimchy a écrit :

> Custom analyzer is simple, and there are plenty of samples, here is one:  
> [GitHub - elastic/elasticsearch-analysis-smartcn: Smart Chinese Analysis Plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-analysis-smartcn).
> 
> Custom similarity (not scorer, I assume?) is simple as well, just not  
> documented. Here is the package where the logic resides:  
> [https://github.com/elasticsearch/elasticsearch/tree/master/src/main/java/org/elasticsearch/index/similarity](https://github.com/elasticsearch/elasticsearch/tree/master/src/main/java/org/elasticsearch/index/similarity).  
> You need to implement a custom SimilarityProvider (  
> [https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/similarity/SimilarityProvider.java](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/index/similarity/SimilarityProvider.java)),  
> and set it using the setting: index.similarity.index.type and  
> index.similarity.search.type (this will override the default ones).
> 
> On Fri, Jan 6, 2012 at 8:00 PM, Scott Decker [scott@publishthis.com](mailto:scott@publishthis.com)wrote:
> 
> > Hey All,  
> > I had searched in the groups here for this info, but it was always  
> > "ping me to get info" =)
> > 
> > How do we go about inserting a custom scorer into Elasticsearch  
> > (insert our own Similarity java object)  
> > How do we go about inserting a custom analyzer - much like inserting a  
> > custom Similarity java object.
> > 
> > We have a specific type of token that we are building, and we have our  
> > own analyzer for breaking the token up correctly, and then using the  
> > custom scorer to then score the matches.
> > 
> > I get how to do this in Lucene, just don't see how we do that in ES so  
> > that the Lucene indexes use these in ES.
> > 
> > Any help would be much appreciated
> > 
> > Thanks,  
> > Scott

---

<div class="post-metadata">

**Author:** ![MING\_LIU](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@MING\_LIU](https://discuss.elastic.co/u/MING_LIU)\
**Post date:** [March 25, 2013, 10:41pm UTC](https://discuss.elastic.co/t/custom-scorer-and-custom-analyzer/6301/9 "2013-03-25T22:41:02Z")

</div>

Kimchy,

Can you provide more details about how to register a custom query parser  
with elasticsearch?

Best,  
Ming

On Monday, January 9, 2012 11:38:27 AM UTC-8, kimchy wrote:

> You can build your own custom query parser, register it with the query  
> registry (it will need to know how to parse itself from a json/xcontent  
> format). The query parser returns a Lucene Query which can create its  
> custom scorer. The nice bit is that once you register a custom query, its  
> part of the query DSL... . Its not documented how to do that, but if you  
> need it, I can explain...
> 
> On Mon, Jan 9, 2012 at 5:15 PM, Scott Decker \<[sc...@publishthis.com](mailto:sc...@publishthis.com)\<javascript:\>
> 
> > wrote:
> 
> > Just for everyone's future searching of the groups.  
> > If we did implement our own Scorer (not a Similarity Object) is it  
> > possible to load that into ES as well? If so, how would we do it.
> > 
> > I am talking about this in Lucene: org.apache.lucene.search.Scorer
> > 
> > Thanks,  
> > Scott
> > 
> > On Jan 6, 1:54 pm, Scott Decker [sc...@publishthis.com](mailto:sc...@publishthis.com) wrote:
> > 
> > > Fantastic! Will go take a look and see if there is anything else we  
> > > may run into.  
> > > Thanks,  
> > > Scott
> > > 
> > > On Jan 6, 1:06 pm, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > > 
> > > > Custom analyzer is simple, and there are plenty of samples, here is  
> > > > one:[GitHub - elastic/elasticsearch-analysis-smartcn: Smart Chinese Analysis Plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-analysis-smartcn).
> > > 
> > > > Custom similarity (not scorer, I assume?) is simple as well, just not  
> > > > documented. Here is the package where the logic resides:  
> > > > [https://github.com/elasticsearch/elasticsearch/tree/master/src/main/j](https://github.com/elasticsearch/elasticsearch/tree/master/src/main/j)....  
> > > > You need to implement a custom SimilarityProvider (  
> > > > [https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j](https://github.com/elasticsearch/elasticsearch/blob/master/src/main/j)...  
> > > > ),  
> > > > and set it using the setting: index.similarity.index.type and  
> > > > index.similarity.search.type (this will override the default ones).
> > > 
> > > > On Fri, Jan 6, 2012 at 8:00 PM, Scott Decker [sc...@publishthis.com](mailto:sc...@publishthis.com)  
> > > > wrote:
> > > > 
> > > > > Hey All,  
> > > > > I had searched in the groups here for this info, but it was always  
> > > > > "ping me to get info" =)
> > > 
> > > > > How do we go about inserting a custom scorer into Elasticsearch  
> > > > > (insert our own Similarity java object)  
> > > > > How do we go about inserting a custom analyzer - much like  
> > > > > inserting a  
> > > > > custom Similarity java object.
> > > 
> > > > > We have a specific type of token that we are building, and we have  
> > > > > our  
> > > > > own analyzer for breaking the token up correctly, and then using the  
> > > > > custom scorer to then score the matches.
> > > 
> > > > > I get how to do this in Lucene, just don't see how we do that in ES  
> > > > > so  
> > > > > that the Lucene indexes use these in ES.
> > > 
> > > > > Any help would be much appreciated
> > > 
> > > > > Thanks,  
> > > > > Scott

--  
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:44am UTC](https://discuss.elastic.co/t/custom-scorer-and-custom-analyzer/6301/10 "2017-07-06T02:44:31Z")

</div>


