Result limitation

Hello,
I created a dashboard in Kibana, and for a particular visualization, I want to limit the results to 500 documents. Is it possible to display only the last 500 documents?
Thanks

What type of visualization are you dealing with?

Added visualisation

Table and bar vertical stacked.

And you want to limit the results before adding it to the visualization so you want to create a chart from the last 500 documents based on a field sorting criteria?

That's correct.
Let's say I'm gonna have a visual including last 500 documents(i.e source.email(vertical) and count of records(horizontal))

I'm afraid you can't do that with Lens, at this moment.

I understand as soon as we have ES|QL available in Lens, you'll be able to feed a query like this to your chart to render just the latest 100 documents

FROM kibana_sample_data_flights
| WHERE timestamp is not null
| SORT timestamp DESC
| LIMIT 100
| KEEP timestamp, Carrier

In the meantime, you may want to give Vega a try since you can write a full query, including the size parameter to limit results.

@Marco_Liberati may keep me honest here or provide further instructions, in case I'm missing something.

It is possible to create a chart with ES|QL in dashboard with a query like that

1 Like

I knew I was missing something, thanks for the pointer Marco!

ES|QL visualizations need to be created from the Dashboard Add panel button as shown below:

esql

1 Like

Thanks.
Would you clarify from which data sources i can fetch data?
index, datastream, data view?

Data Views are not supported since they are a Kibana abstraction. Take a look at the documentation for details