Pie chart with list

Hi my friends I'm very new on kibana. I want to create a pie chart with a field who contains a list, like this:

[passed, passed, passed, passed, failed, failed, failed, passed, passed, passed, passed, passed, passed, passed, failed, passed, passed, failed, passed, passed, passed, passed, passed, passed]

When I create the pie chart I get a 50/50 percentage that is wrong because in this hit on this field there are 19 passed and 5 failed like the list above. I am slice by the field that contains the list and size by count of record. I am not sure what I am doing wrong. Please help.

To solve the problem, there should be a little more detail, such as document mappings, number of "test result" per document, pie chart settings...etc.

Hi I was trying to edit but is not possible.

Hi my friends I'm very new on kibana. I want to create a pie chart with a field who contains a list, like this:
(Login List Status)

This field is a script field where I add the keywords from other field, this is my original json doc:

{
  "ENVA": {
    "Login": {
      "status": "passed"
    }
  },
  "ENVB": {
    "Login": {
      "status": "passed"
    }
  },
  "ENVC": {
    "Login": {
      "status": "passed"
    }
  },
  "ENVD": {
    "Login": {
      "status": "failed"
    }
  }
}

and this is the script field "Login List Status":

List l = new ArrayList();

  l.add(doc['ENVA.Login.status.keyword'].value);
  l.add(doc['ENVB.Login.status.keyword'].value);
  l.add(doc['ENVC.Login.status.keyword'].value);
  l.add(doc['ENVD.Login.status.keyword'].value);
  
return l;

When I create the pie chart I get a 50/50 percentage that is wrong because in this hit on this field there are 23 passed and 1 failed like the list above.

I am slice by the field that contains the list and size by count of record. I am not sure what I am doing wrong. Please help.

the pie chart is for a single document (identified by id or something) or aggregation of multiple documents?

Terms aggregation count documents. It count the document with 23 passed and one failed as one document for passed and one document for failed. This is the reason for that 50/50 pie chart.

Thanks for the answer! Is very helpulf for me.

The pie chart is for multiple documents to count how many passed and failed status are in each document.

Sorry I am very new with kibana.

I see, but it is not straight-forward but a difficult problem with elasticsearch.

So you have to take alternatives with some compromise. There are several approaches that are quite different.

As far as I can think of, there are

  1. use logstash split filter plugin to create a new index with new atomic document.
    eg
    {"ENV": "A", "Login": {"status": "passed"}}
    {"ENV": "B", "Login": {"status": "passed"}}
    {"ENV": "C", "Login": {"status": "passed"}} ...
    This is the structure of documents that kibana is good at, and you can realize various visualizations relatively freely.

  2. create script fields of counting each 'pass' and 'fail' values in LoginListStatus and use "Bar vertical percentage" visualization of lens.


    (This figure is made from documents whose pass/fail count field were typed directly, not from a script)

Thanks a lot!!! Thanks for you time and your answers were very useful

Hi @cris,

If you click the "Inspect" button on the top right on that chart editor, you should see a table with the data underneath the visualization. What values are expressed there?

Also, in the same panel you can switch from table view to request view to get the actual query sent to the server to compute the table. Can you share that (removing sensitive information)?

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