Home > OS >  skip or check null values in DSL query?
skip or check null values in DSL query?

Time:12-01

using elasic search query in order to calulate an api, therefore I am using the bucket_script like below:

bucket_script: {
                  buckets_path: {
                    succ_req: response_recieve>sum_init
                    total_req: response_attemp>sum_init
                  }
                  script: "params.succ_req / params.total_req *100000 "
                }

then using the query to draw a line using vega in kibana, the proble is that with "params.total_req" the return value is null therefor the visual shows up "Infinite extent for field "... how can check if the value is zero then do not calculate

CodePudding user response:

Like this:

 script: "params.total_req != 0 ? (params.succ_req / params.total_req * 100000) : 0"
  • Related