# Custom document scorer

**URL:** <https://discuss.elastic.co/t/custom-document-scorer/3598>\
**Category:** Elasticsearch\
**Created:** [November 25, 2010, 11:39pm UTC](https://discuss.elastic.co/t/custom-document-scorer/3598 "2010-11-25T23:39:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeroens](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jeroens](https://discuss.elastic.co/u/jeroens)\
**Post date:** [November 25, 2010, 11:39pm UTC](https://discuss.elastic.co/t/custom-document-scorer/3598/1 "2010-11-25T23:39:38Z")

</div>

Hello,

I was wondering if it is possible to get back the highest scoring index for  
a field within an array.  
Let's say I have the following document:

{  
"tweet" : {  
"message" : "some arrays in this tweet...",  
"tags" : ["elasticsearch", "wow"],  
"lists" : [  
{  
"name" : "cool\_list1",  
"description" : "very cool"  
},  
{  
"name" : "cool\_list2",  
"description" : "cool"  
}  
]  
}  
}

I'm searching for: tweet.lists.description:cool

Now I would like to get back the array index with the highest relevancy.  
This would be the second one where it says "cool". Is there a way for me to  
implement this?

I have been using Solr for a long time now, but I really like how easy ES  
works and the fantastic scalability features. However, I am missing the  
advanced extendibility possibilities that I have with Solr. Or am I missing  
something?

Kind regards,

Jeroen

---

<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:** [November 26, 2010, 8:30pm UTC](https://discuss.elastic.co/t/custom-document-scorer/3598/2 "2010-11-26T20:30:27Z")

</div>

In this case, you would need to break each item in the list into a different  
document. What feature in Solr allows you to do it?

On Fri, Nov 26, 2010 at 1:39 AM, jeroens [jeroen.steggink@gmail.com](mailto:jeroen.steggink@gmail.com) wrote:

> Hello,
> 
> I was wondering if it is possible to get back the highest scoring index for  
> a field within an array.  
> Let's say I have the following document:
> 
> {  
> "tweet" : {  
> "message" : "some arrays in this tweet...",  
> "tags" : ["elasticsearch", "wow"],  
> "lists" : [  
> {  
> "name" : "cool\_list1",  
> "description" : "very cool"  
> },  
> {  
> "name" : "cool\_list2",  
> "description" : "cool"  
> }  
> ]  
> }  
> }
> 
> I'm searching for: tweet.lists.description:cool
> 
> Now I would like to get back the array index with the highest relevancy.  
> This would be the second one where it says "cool". Is there a way for me to  
> implement this?
> 
> I have been using Solr for a long time now, but I really like how easy ES  
> works and the fantastic scalability features. However, I am missing the  
> advanced extendibility possibilities that I have with Solr. Or am I missing  
> something?
> 
> Kind regards,
> 
> ## Jeroen
> 
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Custom-document-scorer-tp1970264p1970264.html](http://elasticsearch-users.115913.n3.nabble.com/Custom-document-scorer-tp1970264p1970264.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![jeroens](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jeroens](https://discuss.elastic.co/u/jeroens)\
**Post date:** [November 27, 2010, 8:54pm UTC](https://discuss.elastic.co/t/custom-document-scorer/3598/3 "2010-11-27T20:54:42Z")

</div>

I do this in Solr by using a custom similarity class.  
[http://wiki.apache.org/solr/SolrPlugins#Similarity](http://wiki.apache.org/solr/SolrPlugins#Similarity)

---

<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:** [November 30, 2010, 9:24pm UTC](https://discuss.elastic.co/t/custom-document-scorer/3598/4 "2010-11-30T21:24:08Z")

</div>

You can plug in your own Lucene similarity implementation to elasticsearch.  
Not properly documented yet, but ping and I can help once you want to do it.

On Sat, Nov 27, 2010 at 10:54 PM, jeroens [jeroen.steggink@gmail.com](mailto:jeroen.steggink@gmail.com) wrote:

> ## I do this in Solr by using a custom similarity class. [http://wiki.apache.org/solr/SolrPlugins#Similarity](http://wiki.apache.org/solr/SolrPlugins#Similarity)
> 
> View this message in context:  
> [http://elasticsearch-users.115913.n3.nabble.com/Custom-document-scorer-tp1970264p1979090.html](http://elasticsearch-users.115913.n3.nabble.com/Custom-document-scorer-tp1970264p1979090.html)  
> Sent from the Elasticsearch Users mailing list archive at [Nabble.com](http://Nabble.com).

---

<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, 4:15am UTC](https://discuss.elastic.co/t/custom-document-scorer/3598/5 "2017-07-06T04:15:58Z")

</div>


