# Can I customize the inverted index to achieve cosine similarity?

**URL:** <https://discuss.elastic.co/t/can-i-customize-the-inverted-index-to-achieve-cosine-similarity/87830>\
**Category:** Elasticsearch\
**Created:** [June 1, 2017, 2:21am UTC](https://discuss.elastic.co/t/can-i-customize-the-inverted-index-to-achieve-cosine-similarity/87830 "2017-06-01T02:21:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![helloWorldCheer](https://avatars.discourse-cdn.com/v4/letter/h/82dd89/32.png) [@helloWorldCheer](https://discuss.elastic.co/u/helloWorldCheer)\
**Post date:** [June 1, 2017, 2:21am UTC](https://discuss.elastic.co/t/can-i-customize-the-inverted-index-to-achieve-cosine-similarity/87830/1 "2017-06-01T02:21:44Z")

</div>

I want to storage the pairs of keyword and weight of a aticle instead of the full text inelastic search.The document's format is in elasticsearch as follows:  
{title:"XXX",keyWords:{{"keyword1":value1},{"keyword2":value2},{"keyword3":value3}.....} .  
The query's format is as follws:  
{{"query1":value1},{"query2":value2},.....}.  
I want to replace the elasticsearch scoring mechanism with cosine similarity.But there is one question:If I am not based on inverted index to replace the scoring mechanism,then the calculation is [heavy.So](http://heavy.So) I want to know whether I can to customize the inverted index that make the keyword's value storage in the inverted index.  
What should I do?  
Thanks!

---

<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:** [June 29, 2017, 2:21am UTC](https://discuss.elastic.co/t/can-i-customize-the-inverted-index-to-achieve-cosine-similarity/87830/2 "2017-06-29T02:21:50Z")

</div>

Closed on June 29, 2017, 2:21am UTC

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