Elastic kibana explain method into percentage

Hi there,

I currently have a search system that displays percentage of found words in the database. I'm thinking of moving to elastic search, but I still want the results to be displayed as percentage. Is it possible? Currently in Kibana I have an explain function that displays for example the "value" : 0.6931471, How can I convert it to percentage to be used in my system?

Thank you for answers

Hi @aretai,
I tried to solve it with TSVB, but I actually think Vega is the only option here. Here's the screenshot of the similar problem on the sample flights data (Percent of flights delayed in time range (filter ratio)):

This is Vega code:

{
  $schema: https://vega.github.io/schema/vega-lite/v2.json
  data: {
    url: {
      %context%: true
      %timefield%: timestamp
     index: kibana_sample_data_flights
     body: {
            aggs: {
              f: {
                filters: {
                  filters: {
                    delayed: { match_phrase: { FlightDelay: true } }
                    total: { match_all: { } }
                  }
                }
              }
            }
        // Speed up the response by only including aggregation results
        size: 0
      }
    }

    format: {property: "aggregations.f.buckets"}
  }

  mark: text

  transform: [{
    calculate: "datum.delayed.doc_count / datum.total.doc_count",
    as: "percent"
  }]

  encoding: {
    text: {
      field: "percent"
      type: quantitative
      format: ".2%"
    }
    size: { value: 48 }
  }
}

I'd suggest to try it yourself with sample data and adjust the code to your needs.
Let me know if it helps.

Best, Marta

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