# Nested query with decay function score fails with scaled\_float type

**URL:** <https://discuss.elastic.co/t/nested-query-with-decay-function-score-fails-with-scaled-float-type/106506>\
**Category:** Elasticsearch\
**Created:** [November 6, 2017, 10:52am UTC](https://discuss.elastic.co/t/nested-query-with-decay-function-score-fails-with-scaled-float-type/106506 "2017-11-06T10:52:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![1jon](https://avatars.discourse-cdn.com/v4/letter/1/48db29/32.png) [@1jon](https://discuss.elastic.co/u/1jon)\
**Post date:** [November 6, 2017, 10:52am UTC](https://discuss.elastic.co/t/nested-query-with-decay-function-score-fails-with-scaled-float-type/106506/1 "2017-11-06T10:52:59Z")

</div>

Here is the guts of a nested function score query, which works:

```
"query": {
   "function_score": {
        "field_value_factor": {
            "field": "variants.x.laba",
        },
       "query": {
           "bool": {
               "must": [
                     ...
               ],
           }
       }

```

However, if the scoring function is changed to any of the decay functions (gauss, exp, linear), it fails. The failing query looks like:

```
"query": {
   "function_score": {
       "gauss": {
           "variants.x.laba": {
               "origin": 100,
               "scale": 202.3,
           },
       },
       "query": {
           "bool": {
               "must": [
                     ...
               ],
           }
       }

```

and it fails with the error:

elasticsearch.exceptions.RequestError: TransportError(400, 'search\_phase\_execution\_exception', 'field [variants.x.laba] is of type [indexed,omitNorms], but only numeric types are supported.')

but the type mapping is numeric (scaled float); here is a verbatim extract from GET \_mappings:

```
     "x" : {
        "type" : "nested",
        "properties" : {
          "laba" : {
            "type" : "scaled_float",
            "scaling_factor" : 1000.0
          },

```

So it is a numeric field, the same field works correctly with field\_value\_factor.  
I have tried ES versions 5.5.3 and 5.6.3. I have tried making the origin and scale parameters strings (as in the examples).

During the course of writing this post I tried changing the field to a plain float type and that fixed the problem.

A bug? Or have I missed something?

---

<div class="post-metadata">

**Author:** ![colings86](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/colings86/32/44960_2.png) [@colings86](https://discuss.elastic.co/u/colings86)\
**Post date:** [November 6, 2017, 11:02am UTC](https://discuss.elastic.co/t/nested-query-with-decay-function-score-fails-with-scaled-float-type/106506/2 "2017-11-06T11:02:09Z")

</div>

Do you have the stack trace from the Elasticsearch server logs for this error? That would help with determining if this is a bug.

---

<div class="post-metadata">

**Author:** ![1jon](https://avatars.discourse-cdn.com/v4/letter/1/48db29/32.png) [@1jon](https://discuss.elastic.co/u/1jon)\
**Post date:** [November 6, 2017, 11:28am UTC](https://discuss.elastic.co/t/nested-query-with-decay-function-score-fails-with-scaled-float-type/106506/3 "2017-11-06T11:28:14Z")

</div>

There is nothing going into the server log on this error, all I'm getting is what is passed back to the client:

{"error":{"root\_cause":[{"type":"parsing\_exception","reason":"field [variants.x.labl] is of type [indexed,omitNorms], but only numeric types are supported.","line":1,"col":1}],"type":"search\_phase\_execution\_exception","reason":"all shards failed","phase":"query","grouped":true,"failed\_shards":[{"shard":0,"index":"product\_index","node":"oS4ixNR-S3Gc\_LIaigTpGA","reason":{"type":"parsing\_exception","reason":"field [variants.x.labl] is of type [indexed,omitNorms], but only numeric types are supported.","line":1,"col":1}}]},"status":400}

---

<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:** [December 4, 2017, 11:28am UTC](https://discuss.elastic.co/t/nested-query-with-decay-function-score-fails-with-scaled-float-type/106506/4 "2017-12-04T11:28:31Z")

</div>

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