Kibana vega context and timefield

When I include the lines of

// Apply dashboard context filters when set
%context%: true
// Filter the time picker (upper right corner) with this field
%timefield%: @timestamp

I got this error:

* Infinite extent for field "by_currency_code_sum.value": [Infinity, -Infinity]

* Log scale domain includes zero: [,]

* Log scale domain includes zero: [,]

If I delete it, it works
If I cannot do this way how to sync the vega plot with dashboard filters (dates, filters, etc.) for general plots

If no documents match the filter, such Infinity results could be generated. Please check the query with the filter and time stamp filters by itself. Is that result what you expected?

I only need the dashboard filters like dates can be applied to my vega plot, adding these two lines does not work. Also, for some plots with query block inside body it will give me

url.%context% and url.%timefield% must not be used when url.body.query is set

As I said, if this way does not work, any other way to resolve this is also acceptable.

I don't want to write deterministic query inside I want it to be interactive with the dashboard filter features outside. My original plot works fine the query return things properly.

As you said your original plot works fine, the query without filtering must be correct. And the fact that the result change (to Infinity with your example) shows the filtering works in some way. As I said, there is a possibility that no document match the filter, so I recommended to check the query with filter outside vega.

Yes, context and timefield filtering can be only used with aggregation clause and not with query clause.

Yes, context and timefield filtering can be only used with aggregation clause and not with query clause.

What will be the way to filter by dashboard time in this case? Is there a general way to do this for general plot?

This possibility is 0, since I have checked that even if I changed to last two years it still gives me that error, which is impossible.

I suppose the only way to use context and timefield filtering is to implement the query using only aggregation.

If you used query clause to filter documents, you can use Filter aggregation instead of query clause.

If you use "hits" of the query for formatter in vega-lite, it seems difficult but using filter aggregation with scripted metric aggregation "trick" to retrieve all documents in a bucket could be a possible choice though I have not tried.

I see. Please check the Request and Response in Inspector. Are there buckets as you expected?

Do you think any of the code under this section would be helpful other than the methods you mentioned?

Thank you for this point, I will investigate this.

What do you mean by using "hits" of query for formatter? I don't understand this part you said.

Thanks! I've missed it. Sorry for wrongly informed you.

It could be a good way to make query using "%dashboard_context-must_clause%" or "%dashboard_context-filter_clause%".. etc, without %context%: true.

So I can do this for any es query? I can follow this template?

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