Use of tabifyAggResponse in kibana 6.1.x

Dear community,

i am trying to make the computed_columns plugin to work under Kibana 6.1.x.


Invoking tabifyAggResponse results into: TypeError: esResponse.hits is undefined

"function tabifyAggResponse(vis, esResponse, respOpts) {
var write = new TabbedAggResponseWriter(vis, respOpts);

var topLevelBucket = _lodash2.default.assign({}, esResponse.aggregations, {
  doc_count: esResponse.hits.total
});"

i have tried to use resp directly, but in that way i cannot set respOpts.

any clue?

best!
michimau

Hi,

for visualizations we do a precheck if the resp.hits.total actually has results. So I think you should add a check to your code, that checks whether resp.hits exists and resp.hits.total is not equal 0. If it is, Elasticsearch will just have returned no results, in which case you cannot tabify anything.

Cheers
Tim

thank you. however, resp object doesn't look to have hits in the first place:

resp.aggregations:undefined
resp property: aggConfig null
resp property: key null
resp property: title null
resp property: tables Array [ {…} ]
resp property: field
resp property: fieldFormatter

is it possible that something has changed in 6.x.x :frowning:

the response in the spy panel is:
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 15,
"successful": 15,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 14005,
"max_score": 0,
"hits": []
},
"status": 200
}

in case of unstoppable curiosity :):

Hi,

I've checked your sources. When you register your plugin you don't specify a responseHandler property. In this case the default (tabify) will be used. Meaning the resp you see, is already a tabified response.

You can either set responseHandler: 'none' in your vis registration to get the original ES response, or - more recommended - just use resp as the result of tabify, since you anyway want to tabify it.

Cheers,
Tim

thank you so much!!!

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