Unable to create correct visualization

Hi

I created an index in Elasticsearch using elasticsearch_dsl python module. This is just sample data, and looks as follows:

When I try to create a histogram, Kibana displays only rounded numbers. For instance, for the current parameter, instead of displaying 0.5, it displays 0, and instead of 5.4, it displays 5. Here is an example:

Am I missing anything?
Thank you for your help, I am very new to elk.

Hi @plisovyi,

the chart should indeed show the unrounded values. A possible cause is that the "Current" field is defined as a non-floating point type in the mapping of your index. Discover shows the raw values passed to Elasticsearch during ingestion, but the visualization is using aggregations which is working with the indexed values.

Could you run GET /simple_table_1_7/_mapping in the dev tools console and paste the result here to check whether that's the cause? If it is, you have to change the mapping to a floating point number and re-index your data.

Hi @flash1293

Thank you for your help. I have run the command and it produced the following results:

{
"simple_table_1_7" : {
"mappings" : {
"properties" : {
"Current" : {
"type" : "integer"
},
"Timestamp_from_excel" : {
"type" : "date"
},
"Voltage" : {
"type" : "double"
}
}
}
}
}

So my voltage was a double and current was integer - it should be reversed. Have to be more careful. I tried running with these switched, and it now works. For reference, here is the code I am using:

from elasticsearch_dsl import Document, Date, Integer, Text, Double
from elasticsearch_dsl.connections import connections
from elasticsearch.helpers import bulk
import csv

connections.create_connection(hosts=["localhost"])
class WordCloud(Document):
    Timestamp_from_excel = Date()
    Voltage = Integer()
    Current = Double()

    class Index:
        name = "simple_table_1_7"
        doc_type = "my_type"  

WordCloud.init()
with open('Path\\to\\your\\csv\\.csv') as f:
    reader = csv.DictReader(f)
    bulk(
        connections.get_connection(),
        (WordCloud(**row).to_dict(True) for row in reader)
    )

Thanks again for the help

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