# Need help for Custom Score On Array Fields

**URL:** <https://discuss.elastic.co/t/need-help-for-custom-score-on-array-fields/21675>\
**Category:** Elasticsearch\
**Created:** [January 16, 2015, 3:49am UTC](https://discuss.elastic.co/t/need-help-for-custom-score-on-array-fields/21675 "2015-01-16T03:49:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zkidkid](https://avatars.discourse-cdn.com/v4/letter/z/fbc32d/32.png) [@zkidkid](https://discuss.elastic.co/u/zkidkid)\
**Post date:** [January 16, 2015, 3:49am UTC](https://discuss.elastic.co/t/need-help-for-custom-score-on-array-fields/21675/1 "2015-01-16T03:49:54Z")

</div>

Hi All,

Currently I have an array type, and I need to calculate score base on num  
matched terms filters.  
For example:

Here is my mappings :

{  
"tweet" : {  
"properties" : {  
"tags" : {"type" : "string", "index\_name" : "tag"},  
}  
}  
}

My data will be indexed like that :

{  
"tweet" : {  
"tags" : ["USA","VN","GM"]  
}  
}

So if I query with terms filter for : "USA", and "GM"

My score will be 2/3 (it's mean num matched / tags array). (actually the  
score will be calculated with complex formal, but I just one to focus on  
the problem)

Thanks in advance.

--  
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/3d047dbe-20d4-43ac-92c1-d1e21322c13c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3d047dbe-20d4-43ac-92c1-d1e21322c13c%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, 12:38am UTC](https://discuss.elastic.co/t/need-help-for-custom-score-on-array-fields/21675/2 "2017-07-06T00:38:30Z")

</div>


