# Hit/Token Properties & Advanced Scoring

**URL:** <https://discuss.elastic.co/t/hit-token-properties-advanced-scoring/18795>\
**Category:** Elasticsearch\
**Created:** [July 22, 2014, 3:02pm UTC](https://discuss.elastic.co/t/hit-token-properties-advanced-scoring/18795 "2014-07-22T15:02:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ankit\_Jain\_2](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@Ankit\_Jain\_2](https://discuss.elastic.co/u/Ankit_Jain_2)\
**Post date:** [July 22, 2014, 3:02pm UTC](https://discuss.elastic.co/t/hit-token-properties-advanced-scoring/18795/1 "2014-07-22T15:02:08Z")

</div>

Hi there,

Thanks for all the wonderful discussion on this mailing list. Has really  
helped our life much easier!

Two questions:

1. Is it possible to store properties of tokens within each document so  
that they can be retrieved during retrieval and then used in scoring?  
[detailed example after questions]
2. What's the best way to create advanced scorers that can look at hits  
and all of their properties (position in document, custom score associated  
with the hit for this document [like the one from #1])

In a document, in addition to having the document's own content, I want to  
have a set of 'related keywords' so that I can retrieve by them. However,  
each related keyword has an associated score of 'relatedness'. I would  
like to store this and use it at scoring time so that some keywords can  
count more than others. How would I best do this?

Thanks,  
Ankit Jain

--  
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/6669c195-db69-45a5-b201-c385d67b1cf7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6669c195-db69-45a5-b201-c385d67b1cf7%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 23, 2014, 6:04am UTC](https://discuss.elastic.co/t/hit-token-properties-advanced-scoring/18795/2 "2014-07-23T06:04:56Z")

</div>

1. You can retrieve the term position, offset and payload using function  
score scripts:  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-advanced-scripting.html)

2: There are a couple of proposed solutions that would store the data in  
another index that is joined with the main query. Matt Weber's PR, if ever  
merged, might help: [Terms Lookup by Query/Filter (aka. Join Filter) by mattweber · Pull Request #3278 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/pull/3278)  
Can't think of a current solution without a join.

Cheers,

Ivan

On Tue, Jul 22, 2014 at 8:02 AM, Ankit Jain [ankit@quettra.com](mailto:ankit@quettra.com) wrote:

> Hi there,
> 
> Thanks for all the wonderful discussion on this mailing list. Has really  
> helped our life much easier!
> 
> Two questions:
> 
> 1. Is it possible to store properties of tokens within each document  
> so that they can be retrieved during retrieval and then used in scoring?  
> [detailed example after questions]
> 2. What's the best way to create advanced scorers that can look at  
> hits and all of their properties (position in document, custom score  
> associated with the hit for this document [like the one from #1])
> 
> In a document, in addition to having the document's own content, I want to  
> have a set of 'related keywords' so that I can retrieve by them. However,  
> each related keyword has an associated score of 'relatedness'. I would  
> like to store this and use it at scoring time so that some keywords can  
> count more than others. How would I best do this?
> 
> Thanks,  
> Ankit Jain
> 
> --  
> 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/6669c195-db69-45a5-b201-c385d67b1cf7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6669c195-db69-45a5-b201-c385d67b1cf7%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/6669c195-db69-45a5-b201-c385d67b1cf7%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/6669c195-db69-45a5-b201-c385d67b1cf7%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CALY%3DcQD%2B-WFfyF8MD0%2BCq\_ytFkf\_b%3DHeQPTbKNPttr7%3DC6EG\_g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQD%2B-WFfyF8MD0%2BCq_ytFkf_b%3DHeQPTbKNPttr7%3DC6EG_g%40mail.gmail.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, 1:14am UTC](https://discuss.elastic.co/t/hit-token-properties-advanced-scoring/18795/3 "2017-07-06T01:14:04Z")

</div>


