# Using my own score function to sort results

**URL:** <https://discuss.elastic.co/t/using-my-own-score-function-to-sort-results/240000>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [July 6, 2020, 12:11pm UTC](https://discuss.elastic.co/t/using-my-own-score-function-to-sort-results/240000 "2020-07-06T12:11:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![spadel](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@spadel](https://discuss.elastic.co/u/spadel)\
**Post date:** [July 6, 2020, 12:11pm UTC](https://discuss.elastic.co/t/using-my-own-score-function-to-sort-results/240000/1 "2020-07-06T12:11:59Z")

</div>

I have a list of documents, which contain basic sentences. Depending on the semantic similarity to a search query, I want to give each sentence a score. For this purpose, I am using a neural network, which will do exactly that. It takes a query sentence as input, transforms it to a vector and computes the cosine similarity with all the sentences in my database, which represents a similarity score. I want to then sort my results based on that similarity score.

I am therefore looking for a way, to implement my personal scoring function into the App Search Environment. How can I do that?

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![qhoxie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/qhoxie/32/47252_2.png) [@qhoxie](https://discuss.elastic.co/u/qhoxie)\
**Post date:** [July 7, 2020, 11:51pm UTC](https://discuss.elastic.co/t/using-my-own-score-function-to-sort-results/240000/2 "2020-07-07T23:51:32Z")

</div>

Hello — App Search does allow customization of scoring via the dashboard and the API, but not at the level you are looking for.

Elasticsearch can accomplish what you describe. Here's a great post about it: [https://www.elastic.co/blog/text-similarity-search-with-vectors-in-elasticsearch](https://www.elastic.co/blog/text-similarity-search-with-vectors-in-elasticsearch)

---

<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:** [August 4, 2020, 11:51pm UTC](https://discuss.elastic.co/t/using-my-own-score-function-to-sort-results/240000/3 "2020-08-04T23:51:43Z")

</div>

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