document_missing_exception: document_missing_exception: [_doc][id]: document missing
Elasticsearch의미
갱신(_update)할 문서를 인덱스에서 찾을 수 없다. 갱신에는 기존 문서가 필요하며, 문서가 없으면 이 exception이 발생한다.
원인
문서가 이전에 삭제됨, 생성된 적 없음, 잘못된 _id 사용, 잘못된 인덱스로 요청, 또는 custom routing으로 기록된 문서에 routing 없이 접근. (GET과 _update는 실시간이므로 refresh 지연은 이 오류의 원인이 아니다.)
해결 방법
_id와 대상 인덱스가 올바른지 확인한다: GET /index-name/_doc/id. 있으면 갱신, 없으면 생성하는 동작을 원하면 _update 요청에서 upsert(또는 doc_as_upsert:true)를 사용한다. index(PUT)로 문서를 직접 생성한다. 애플리케이션에서 이 exception을 잡아 upsert 로직으로 fallback한다.
같은 데이터베이스의 다른 항목
- search_phase_execution_exceptionsearch_phase_execution_exception: all shards failed / Failed to execute phase [query]
- too_many_clausestoo_many_clauses: maxClauseCount is set to 1024 (query contains too many clauses)
- version_conflict_engine_exceptionversion_conflict_engine_exception: [_doc][id]: version conflict, current version [x] is different than the one provided [y] (HTTP 409)
- 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)
- cluster_health_redcluster health status: RED / unassigned shards (클러스터 상태 RED / 미할당 샤드)
- no_shard_available_action_exceptionno_shard_available_action_exception: No shard available for [...]