# Payload scoring in elasticsearch?

**URL:** https://discuss.elastic.co/t/payload-scoring-in-elasticsearch/297878
**Category:** Elasticsearch
**Created:** [February 22, 2022, 10:58am UTC](https://discuss.elastic.co/t/payload-scoring-in-elasticsearch/297878 "2022-02-22T10:58:27Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![pauloamed](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pauloamed/32/102087_2.png) [@pauloamed](https://discuss.elastic.co/u/pauloamed)
#### Post date: [February 22, 2022, 10:58am UTC](https://discuss.elastic.co/t/payload-scoring-in-elasticsearch/297878/1 "2022-02-22T10:58:28Z")

</div>

Hey!

I've been trying to write a custom text scoring function in Elasticsearch and I can't find a way to do it. I want to weight the score of each query term with a payload passed inside the query. How can I do it using elastichsearch?

There are similar posts to this, but neither of them with answers:

> [@Payload Scoring in ElasticSearch](https://discuss.elastic.co/t/payload-scoring-in-elasticsearch/143431):
>
> Solr has specific feature to allow scoring based on payload - {!payload\_score f=payload\_field func=sum operator=or}A B C [https://lucene.apache.org/solr/guide/7\_1/other-parsers.html#payload-score-parser](https://lucene.apache.org/solr/guide/7_1/other-parsers.html#payload-score-parser) Is there any similar functionality in ES, which can allow scoring based on terms in payload field and , score can be a sum of payloads.

> [@Using payloads for scoring](https://discuss.elastic.co/t/using-payloads-for-scoring/219476):
>
> I am working on a research project in which I need to use some specific term weights for relevance score calculation. I have indexed the term weights as payloads along with the text and looks something like this : "Americans|5.432 to|0.000 rate|5.466 their|6.080 ideology|3.303 on|0.000 a|0.000 liberal-to-conservative|0.000 scale|3.455 of|0.000 1|0.000 to|0.000 5.|0.000 The|0.000 average|5.201 " Now, I want to use these term weights in the relevance score calculation. I was searching for it and…

Is it an open issue?

Cheers,  
Paulo

---

<div class="post-metadata">

### Author: ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)
#### Post date: [February 22, 2022, 4:48pm UTC](https://discuss.elastic.co/t/payload-scoring-in-elasticsearch/297878/2 "2022-02-22T16:48:06Z")

</div>

Hi,

It is a bit more complex than weight terms by payload, [Function score](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html) does not help you?

---

<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: [March 22, 2022, 4:48pm UTC](https://discuss.elastic.co/t/payload-scoring-in-elasticsearch/297878/3 "2022-03-22T16:48:42Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
