Limit the number of search result in a dashboard

Hello,

is it possible to limit the number of results returned by a Saved Search on a dashboard ?

I want to display the last 100 documents for example. I can't use a datatable because I don't want aggregation, etc...

Thanks

Hello,
You can change the number of results by changing this setting inside Management -> Advanced Settings: discover:sampleSize
The default is 500.

The saved search shown on the dashboard doesn't take this limit into account.

OK, I see the bug, i'll add it in Github and make sure that the setting is taken in account when using saved search queries on the dashboard as well.
In the meantime you can modify the saved search in the Management -> Saved Objects page and add "size": 10 to the search object, like in the screenshot below.

1 Like

Ok, but it's still the same problem.

Here is the full json object:

{
  "index": "winlogbeat-*",
  "query": {
    "query_string": {
      "analyze_wildcard": true,
      "query": "*"
    }
  },
  "filter": [],
  "size": 10,
  "highlight": {
    "pre_tags": [
      "@kibana-highlighted-field@"
    ],
    "post_tags": [
      "@/kibana-highlighted-field@"
    ],
    "fields": {
      "*": {}
    },
    "require_field_match": false,
    "fragment_size": 2147483647
  },
  "highlightAll": true
}

And it still shows all of them on the dashboard? For me it just shows 10 and it doesn't let you tab through more:

Maybe you're on a different version, i'm using 5.4.0.

Yes, it shows everything...

I'm using 5.4.0 too

I think I may have found the problem. I still had the discover:sampleSize set.
The behavior looks like this: that setting isn't taken in account in the dashboard, unless you have the size field inside your saved object. So for the workaround to work for you, you need to set both limits: the size inside the the object and the advanced setting (which is the one whose number is taken into account).

I had added an issue on the Kibana repo and I'll update it with this new information. https://github.com/elastic/kibana/issues/11758

1 Like

Yes! it works !
Thank you very much for your help and for your quick response.

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