# Search application mustache template issue when passing floats vs integers

**URL:** <https://discuss.elastic.co/t/search-application-mustache-template-issue-when-passing-floats-vs-integers/376062>\
**Category:** Elastic Search\
**Created:** [March 18, 2025, 11:10am UTC](https://discuss.elastic.co/t/search-application-mustache-template-issue-when-passing-floats-vs-integers/376062 "2025-03-18T11:10:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Lowe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_lowe/32/140351_2.png) [@David\_Lowe](https://discuss.elastic.co/u/David_Lowe)\
**Post date:** [March 18, 2025, 11:10am UTC](https://discuss.elastic.co/t/search-application-mustache-template-issue-when-passing-floats-vs-integers/376062/1 "2025-03-18T11:10:32Z")

</div>

I am using a search\_application, mustache template to execute a KNN search. The following is the relevant section of the template:

```auto
 "knn": [
          {
            "field": "content_embedding_external.predicted_value",
            "k": {{knn_size}},
            "num_candidates": {{knn_num_of_candidates}},
            "boost": {{vector_content_boost}},
            "similarity": "{{{knn_minimum_similarity}}}",
            "query_vector": {{{query_string_embeddings}}}
            ]
          }

```

The endpoint is:

```auto
/_application/search_application/template_search-arroway-v1/_render_query

```

Here's the thing, when I pass in (abbreviated for the purpose of this post):

```auto
{
  "params": {
    "query_string_embeddings": "[0,1,2]"
  }
}

```

Everything works as expected. That is the KNN query\_vector displays with the array value of: [0,1,2] as one would expect.

BUT, if I pass the parameter as it needs to be (ADA embedding), like:

```auto
"query_string_embeddings": "[-0.021204991,-0.013258362,0.011000876]",

```

I get the error:

```auto
{
    "error": {
        "root_cause": [
            {
                "type": "null_pointer_exception",
                "reason": "Cannot invoke \"com.fasterxml.jackson.core.JsonLocation.getLineNr()\" because \"loc\" is null"
            }
        ],
        "type": "null_pointer_exception",
        "reason": "Cannot invoke \"com.fasterxml.jackson.core.JsonLocation.getLineNr()\" because \"loc\" is null"
    },
    "status": 500
}

```

I would appear that underlying search template/jackson json parsing, has a bug related to floats. Then again, I might need to encode passing of the parameters differently.

Suggestions?

---

<div class="post-metadata">

**Author:** ![Kathleen\_DeRusso](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kathleen_derusso/32/132039_2.png) [@Kathleen\_DeRusso](https://discuss.elastic.co/u/Kathleen_DeRusso)\
**Post date:** [March 18, 2025, 1:12pm UTC](https://discuss.elastic.co/t/search-application-mustache-template-issue-when-passing-floats-vs-integers/376062/2 "2025-03-18T13:12:14Z")

</div>

Hi @David_Lowe thanks for reaching out about this. This is a known bug with search applications, you can track it here: [Search Application Template: use decimal value as param triggers error · Issue #116246 · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues/116246)

Unfortunately it looks like right now the workaround is to use search templates in Elasticsearch rather than the templates provided in search applications.

---

<div class="post-metadata">

**Author:** ![David\_Lowe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_lowe/32/140351_2.png) [@David\_Lowe](https://discuss.elastic.co/u/David_Lowe)\
**Post date:** [March 18, 2025, 5:09pm UTC](https://discuss.elastic.co/t/search-application-mustache-template-issue-when-passing-floats-vs-integers/376062/3 "2025-03-18T17:09:19Z")

</div>

Well that's far from ideal. At least I won't beat my head against the wall trying to figure out why it isn't working as expected. So thank you.

Anyways, is this defect on an actual roadmap to be fixed? Or is just sitting pending prioritization. If the former, are you able to share the anticipated release?

---

<div class="post-metadata">

**Author:** ![nickchow](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickchow/32/42547_2.png) [@nickchow](https://discuss.elastic.co/u/nickchow)\
**Post date:** [March 18, 2025, 6:58pm UTC](https://discuss.elastic.co/t/search-application-mustache-template-issue-when-passing-floats-vs-integers/376062/4 "2025-03-18T18:58:21Z")

</div>

Hi @David_Lowe - it hasn't been prioritized yet, we're still planning out how we'd like to progress with Search Applications. As @Kathleen_DeRusso mentioned, I'd encourage you to see if search templates works for 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:** [April 15, 2025, 6:59pm UTC](https://discuss.elastic.co/t/search-application-mustache-template-issue-when-passing-floats-vs-integers/376062/5 "2025-04-15T18:59:13Z")

</div>

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