I am trying to create a table using elastic search, but I get the following exception at times when the count of my bucket increases the limit. I am fine to have this exception as long I am able to send it to user that they need to decrease the options they have chosen. I am using high level rest client. I am not able to catch particular type of exception "too_many_buckets" seems its binded in ResponseException. Rest Type also doesnt declare this exception separately for me to know this exception occured.
Can someone give me the java code to catch this exception. Exception stack trace:
{"error":{"root_cause":[{"type":"too_many_buckets_exception","reason":"Trying to create too many buckets. Must be less than or equal to: [100000] but was [100001]. This limit can be set by changing the [search.max_buckets] cluster level setting.","max_buckets":100000}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"yogurt_us_insights","node":"wXMuev7GR6WVDS-FKki0Qw","reason":{"type":"too_many_buckets_exception","reason":"Trying to create too many buckets. Must be less than or equal to: [100000] but was [100001]. This limit can be set by changing the [search.max_buckets] cluster level setting.","max_buckets":100000}}]},"status":503}