Java Code Examples for org.elasticsearch.ElasticsearchException#getCause()

The following examples show how to use org.elasticsearch.ElasticsearchException#getCause() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EsIndexImpl.java    From io with Apache License 2.0 5 votes vote down vote up
@Override
SearchResponse onParticularError(ElasticsearchException e) {
    if (e instanceof IndexMissingException || e.getCause() instanceof IndexMissingException) {
        return null;
    }
    if (e instanceof SearchPhaseExecutionException) {
        throw new EsClientException("unknown property was appointed.", e);
    }
    throw e;
}
 
Example 2
Source File: EsTypeImpl.java    From io with Apache License 2.0 5 votes vote down vote up
@Override
PutMappingResponse onParticularError(ElasticsearchException e) {
    if (e instanceof IndexNotFoundException || e.getCause() instanceof IndexNotFoundException) {
        throw new EsClientException.EsIndexMissingException(e);
    }
    if (e instanceof MapperParsingException) {
        throw new EsClientException.EsSchemaMismatchException(e);
    }
    throw e;
}
 
Example 3
Source File: EsTypeImpl.java    From io with Apache License 2.0 5 votes vote down vote up
@Override
DeleteResponse onParticularError(ElasticsearchException e) {
    if (e instanceof IndexNotFoundException || e.getCause() instanceof IndexNotFoundException) {
        throw new EsClientException.EsIndexMissingException(e);
    }
    if (e instanceof VersionConflictEngineException) {
        throw new EsClientException.EsVersionConflictException(e);
    }
    throw e;
}
 
Example 4
Source File: EsTypeImpl.java    From io with Apache License 2.0 5 votes vote down vote up
@Override
DeleteResponse onParticularError(ElasticsearchException e) {
    if (e instanceof IndexMissingException || e.getCause() instanceof IndexMissingException) {
        throw new EsClientException.EsIndexMissingException(e);
    }
    if (e instanceof VersionConflictEngineException) {
        throw new EsClientException.EsVersionConflictException(e);
    }
    throw e;
}
 
Example 5
Source File: EsTypeImpl.java    From io with Apache License 2.0 5 votes vote down vote up
@Override
SearchResponse onParticularError(ElasticsearchException e) {
    if (e instanceof IndexNotFoundException || e.getCause() instanceof IndexNotFoundException) {
        return new DcNullSearchResponse();
    }
    if (e instanceof SearchPhaseExecutionException) {
        throw new EsClientException("unknown property was appointed.", new DcSearchPhaseExecutionException(e));
    }
    throw e;
}
 
Example 6
Source File: EsTypeImpl.java    From io with Apache License 2.0 5 votes vote down vote up
@Override
IndexResponse onParticularError(ElasticsearchException e) {
    if (e instanceof IndexNotFoundException || e.getCause() instanceof IndexNotFoundException) {
        throw new EsClientException.EsIndexMissingException(e);
    }
    if (e instanceof VersionConflictEngineException) {
        throw new EsClientException.EsVersionConflictException(e);
    }
    if (e instanceof MapperParsingException) {
        throw new EsClientException.EsSchemaMismatchException(e);
    }
    throw e;
}
 
Example 7
Source File: EsTypeImpl.java    From io with Apache License 2.0 5 votes vote down vote up
@Override
GetResponse onParticularError(ElasticsearchException e) {
    if (e instanceof IndexMissingException || e.getCause() instanceof IndexMissingException) {
        return null;
    }
    throw e;
}
 
Example 8
Source File: EsTypeImpl.java    From io with Apache License 2.0 5 votes vote down vote up
@Override
IndexResponse onParticularError(ElasticsearchException e) {
    if (e instanceof IndexNotFoundException || e.getCause() instanceof IndexNotFoundException) {
        throw new EsClientException.EsIndexMissingException(e);
    }
    if (e instanceof MapperParsingException) {
        throw new EsClientException.EsSchemaMismatchException(e);
    }
    // 既知のExceptionの場合はINFOログ
    // 新規のExceptionの場合はWARNログ
    if (e instanceof DocumentAlreadyExistsException) {
        if (e.getClass() != null) {
            log.info(e.getClass().getName() + " : " + e.getMessage());
        } else {
            log.info(e.getMessage());
        }
    } else {
        if (e.getClass() != null) {
            log.warn(e.getClass().getName() + " : " + e.getMessage());
        } else {
            log.warn(e.getMessage());
        }
    }
    // 例外が発生した場合でもドキュメントが登録されている可能性がある。
    // そのため、登録チェックを行い、データが登録済の場合は正常なレスポンスを返却する。
    return checkDocumentCreated(id, data, e);
}
 
Example 9
Source File: EsTypeImpl.java    From io with Apache License 2.0 5 votes vote down vote up
@Override
IndexResponse onParticularError(ElasticsearchException e) {
    if (e instanceof IndexMissingException || e.getCause() instanceof IndexMissingException) {
        throw new EsClientException.EsIndexMissingException(e);
    }
    if (e instanceof VersionConflictEngineException) {
        throw new EsClientException.EsVersionConflictException(e);
    }
    if (e instanceof MapperParsingException) {
        throw new EsClientException.EsSchemaMismatchException(e);
    }
    throw e;
}
 
Example 10
Source File: EsIndexImpl.java    From io with Apache License 2.0 5 votes vote down vote up
@Override
SearchResponse onParticularError(ElasticsearchException e) {
    if (e instanceof IndexMissingException || e.getCause() instanceof IndexMissingException) {
        return null;
    }
    if (e instanceof SearchPhaseExecutionException) {
        throw new EsClientException("unknown property was appointed.", e);
    }
    throw e;
}
 
Example 11
Source File: EsTypeImpl.java    From io with Apache License 2.0 5 votes vote down vote up
@Override
boolean isParticularError(ElasticsearchException e) {
    return e instanceof IndexMissingException
            || e.getCause() instanceof IndexMissingException
            || e instanceof VersionConflictEngineException
            || e instanceof MapperParsingException;
}
 
Example 12
Source File: EsIndexImpl.java    From io with Apache License 2.0 5 votes vote down vote up
@Override
DeleteIndexResponse onParticularError(ElasticsearchException e) {
    if (e instanceof IndexNotFoundException || e.getCause() instanceof IndexNotFoundException) {
        throw new EsClientException.EsIndexMissingException(e);
    }
    throw e;
}
 
Example 13
Source File: EsIndexImpl.java    From io with Apache License 2.0 5 votes vote down vote up
@Override
CreateIndexResponse onParticularError(ElasticsearchException e) {
    if (e instanceof IndexAlreadyExistsException
            || e.getCause() instanceof IndexAlreadyExistsException) {
        throw new EsClientException.EsIndexAlreadyExistsException(e);
    }
    throw e;
}
 
Example 14
Source File: EsIndexImpl.java    From io with Apache License 2.0 4 votes vote down vote up
@Override
boolean isParticularError(ElasticsearchException e) {
    return e instanceof IndexNotFoundException
            || e.getCause() instanceof IndexNotFoundException
            || e instanceof SearchPhaseExecutionException;
}
 
Example 15
Source File: EsTypeImpl.java    From io with Apache License 2.0 4 votes vote down vote up
@Override
boolean isParticularError(ElasticsearchException e) {
    return e instanceof IndexMissingException
            || e.getCause() instanceof IndexMissingException
            || e instanceof VersionConflictEngineException;
}
 
Example 16
Source File: EsTypeImpl.java    From io with Apache License 2.0 4 votes vote down vote up
@Override
boolean isParticularError(ElasticsearchException e) {
    return e instanceof IndexNotFoundException
            || e.getCause() instanceof IndexNotFoundException
            || e instanceof SearchPhaseExecutionException;
}
 
Example 17
Source File: EsIndexImpl.java    From io with Apache License 2.0 4 votes vote down vote up
@Override
boolean isParticularError(ElasticsearchException e) {
    return e instanceof IndexNotFoundException || e.getCause() instanceof IndexNotFoundException;
}
 
Example 18
Source File: EsTypeImpl.java    From io with Apache License 2.0 4 votes vote down vote up
@Override
boolean isParticularError(ElasticsearchException e) {
    return e instanceof IndexNotFoundException
            || e.getCause() instanceof IndexNotFoundException
            || e instanceof MapperParsingException;
}
 
Example 19
Source File: EsIndexImpl.java    From io with Apache License 2.0 2 votes vote down vote up
/**
 * リトライ時、引数に指定された例外を特別扱いする場合、trueを返すようにオーバーライドすること.
 * これにより、#onParticularErrorメソッドが呼び出される.
 * 標準実装では, 常に falseを返す.
 * @param e 検査対象の例外
 * @return true: 正常終了として扱う場合, false: 左記以外の場合
 */
@Override
boolean isParticularError(ElasticsearchException e) {
    return e instanceof IndexAlreadyExistsException || e.getCause() instanceof IndexAlreadyExistsException;
}
 
Example 20
Source File: EsIndexImpl.java    From io with Apache License 2.0 2 votes vote down vote up
/**
 * リトライ時、引数に指定された例外を特別扱いする場合、trueを返すようにオーバーライドすること.
 * これにより、#onParticularErrorメソッドが呼び出される.
 * 標準実装では, 常に falseを返す.
 * @param e 検査対象の例外
 * @return true: 正常終了として扱う場合, false: 左記以外の場合
 */
@Override
boolean isParticularError(ElasticsearchException e) {
    return e instanceof IndexAlreadyExistsException || e.getCause() instanceof IndexAlreadyExistsException;
}