Grafana treats non-zero values as zero

Hello!
I was trying to make a simple request to elasticsearch.

But what i get is the data with nonzero measurements.FailurePorbability.
pic2

I can’t imagine why might it happen.

This field “measurements” has type keyword(). In the query inspector I see the following
{"query_string":{"analyze_wildcard":true,"query":"id_: ....(some id_)... AND measurements.FailureProbability: 0"}}]}}

In the JSON file i can see

        {
          "config": {
            "filterable": true
          },
          "name": "measurements",
          "type": "other",
          "values": [
            [
              {
                "FailureProbability": 0.00014286
              }
            ]
          ],
          "state": {
            "displayName": "measurements"
          }
        },

The id_ does not matter. There is only one result with this particular id_. If i delete condition FailurePorbability:0 i will get exactly the same results. If i try FailurePorbability: 0.00014286 it does not find anything.

I am using Grafana v8.3.2 on Ubuntu.

Does anyone one why can it work in this strange way and how to handle it?

welcome to the :grafana: community @andriianikushyn!

Are you able to share a sample document or two and the mapping for the fields shown in your query? Then the community could mock this up and might be able to give you some theories by trying it out.

What version of elasticsearch and grafana are you using?

1 Like

My question was solved: the problem was that in the new version of our DB occasionally the filed had type “long”.
That’s why all float numbers were stored as integer.
The float number that I saw in in JSON it (probably was) the source which has not been changed.

Good explanation is here https://xeraa.net/blog/2020_elasticsearch-coerce-float-to-integer-or-long/

1 Like