# Elastic search Kotlin Function score query

**URL:** https://discuss.elastic.co/t/elastic-search-kotlin-function-score-query/313684
**Category:** Elasticsearch
**Created:** [September 5, 2022, 12:53pm UTC](https://discuss.elastic.co/t/elastic-search-kotlin-function-score-query/313684 "2022-09-05T12:53:05Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Meir\_Levi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/meir_levi/32/110477_2.png) [@Meir\_Levi](https://discuss.elastic.co/u/Meir_Levi)
#### Post date: [September 5, 2022, 12:53pm UTC](https://discuss.elastic.co/t/elastic-search-kotlin-function-score-query/313684/1 "2022-09-05T12:53:05Z")

</div>

Hey I'm using kotlin and I want to write a code that run this query:

```auto
{
  "query": {
    "function_score": {
      "query": {
        "match_all": {}
      },
      "functions": [
        {
          "random_score": {
            "seed": 314159265359
          }
        },
        {
          "gauss": {
            "created_at_dt": {
              "origin": "2013-09-17",#default is current time
              "scale": "1d", 
              "decay": 0.5
            }
          }
        }
      ],
      "score_mode": "multiply"
    }
  }
}

```

I couldn't find any good examples on how to build this kind of query.  
Thank you!

---

<div class="post-metadata">

### Author: ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)
#### Post date: [September 5, 2022, 2:22pm UTC](https://discuss.elastic.co/t/elastic-search-kotlin-function-score-query/313684/2 "2022-09-05T14:22:17Z")

</div>

Hi @Meir_Levi

You can use the version by [community contribuitor](https://www.elastic.co/guide/en/elasticsearch/client/community/current/index.html#kotlin).

---

<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: [October 3, 2022, 2:22pm UTC](https://discuss.elastic.co/t/elastic-search-kotlin-function-score-query/313684/3 "2022-10-03T14:22:52Z")

</div>

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