too_many_clauses: too_many_clauses: maxClauseCount is set to 1024 (query contains too many clauses)(クエリの句が多すぎる)
Elasticsearch意味
クエリが許可された Lucene 句の最大数を超えた。ES 8.x ではこの上限は固定ではなく、ノードのヒープサイズと検索スレッド数から自動で算出され (ヒープの小さいノードでは 1024 まで下がることがある)、エラーメッセージに現在の値が示される。非常に大きな bool クエリや多数の語に展開されるクエリが原因となる。
原因
プログラムで生成された数千の should/must 句を持つ bool クエリ、多数の語に展開される wildcard/prefix/fuzzy/query_string クエリ、深くネストした bool 構造。注: terms クエリ (単一フィールドに対する値リスト) はこの上限の対象外であり、その上限は index.max_terms_count (デフォルト 65,536)。
対処方法
クエリを簡素化する: 単一フィールドに対する多数の term 句を 1 つの terms クエリ (大きなリストには terms lookup) にまとめる。wildcard/prefix の代わりに、より具体的なクエリタイプや index_prefixes/keyword フィールドを使う。ES 8.x では indices.query.bool.max_clause_count 設定は非推奨で無視される。上限を上げるにはノードのヒープを増やす。クエリの生成ロジックを見直す。
同じデータベースの他の項目
- strict_dynamic_mapping_exceptionstrict_dynamic_mapping_exception: mapping set to strict, dynamic introduction of [...] within [...] is not allowed(strict マッピングで新しいフィールドの動的追加は不可)
- illegal_argument_exception_fielddataillegal_argument_exception: Fielddata is disabled on text fields by default. Set fielddata=true on [your_field] in order to load fielddata in memory(text フィールドの fielddata はデフォルトで無効)
- search_phase_execution_exceptionsearch_phase_execution_exception: all shards failed / Failed to execute phase [query](全シャードで検索フェーズの実行に失敗)
- version_conflict_engine_exceptionversion_conflict_engine_exception: [_doc][id]: version conflict, current version [x] is different than the one provided [y] (HTTP 409)(バージョンの競合)
- document_missing_exceptiondocument_missing_exception: [_doc][id]: document missing(ドキュメントが存在しない)
- index_not_found_exceptionindex_not_found_exception: no such index [index_name] (HTTP 404)(インデックスが存在しない)
- resource_already_exists_exceptionresource_already_exists_exception: index [index_name/uuid] already exists (HTTP 400)(インデックスがすでに存在する)