_field_caps API takes long time (more than a minute) to return results causing kibana to not be able to refresh index pattern

Elasticsearch version 6.7.2

JVM version Java HotSpot(TM) 64-Bit Server VM (1.8.0_172):

OS version Linux

field_caps API takes long time (more than a minute) to return results :

Steps to reproduce :
1.) Index pattern with about 409 matching indices with about 61 fields
2.) curl -XGET https://esurl:9200/indexpattern-/_field_caps?fields=
2.) Takes 1 minute 45 seconds to get the result.

This causes kibana to not be able to refresh the index pattern as default timeout is set to 30 seconds.
Is it on expected lines , Anything that can be done to speed up this api ?. Cluster is not resource constrained?

I found a similar issue Kibana index is unresponsive
with responses by @chrisronline

Hi @nikhil-bhat,

To get a ball bark idea of the impact, I attempted to run GET _field_caps?fields=* -- which should be rather expensive -- on a moderate 6.7 cloud cluster with 268 indices, most of them generated by metricbeat with 1342 fields, and the response took about 1s.

Are you certain that your cluster is not under pressure?

Rgs,
Dimitris

hi @dliappis hope you are having a pleasant day .
the cluster in question is not under any load .

the field caps api still took above 1minute for the index pattern(415 indices) with 71 fields .
should i attach node stats and any other detail for emphasis.
All of the indices are of size less than 30 mb .

Hey @nikhil-bhat,

Could you collect the output from the hot_threads API during the execution of your field caps query and paste here the top entries? Please take care that you mask any private data, such as public IP addresses, before posting here.

Dimitris