DolphaGo / TIL

TIL & issues
0 stars 1 forks source link

[ElasticSerach] ElasticSearch에서 10000개 이상을 조회하면 생기는 이슈 #103

Open DolphaGo opened 2 years ago

DolphaGo commented 2 years ago
2022-05-29 23:33:36.082 ERROR 6031 --- [nio-8080-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is RestStatusException{status=400} org.springframework.data.elasticsearch.RestStatusException: Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]; nested exception is ElasticsearchStatusException[Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Result window is too large, from + size must be less than or equal to: [10000] but was [85461]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Result window is too large, from + size must be less than or equal to: [10000] but was [85461]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.]];] with root cause

인덱스 설정을 다음과 같이 수정해주자.

PUT {your_index_name}/_settings
{
  "max_result_window": {want to limit}
}

ex)

PUT dogcenter/_settings
{
  "max_result_window": 500000
}