elasticsearchindexingelastic-stackmetricssharding

Index fail cause in Elastic Search


I am working on the Elastic Search (v7.10) and see that the statistic metric "indexing.index_failed" has increased. But I want to know the reasons why it failed.

In my application, I used the Rest High-level Client and have caught the exception. But I found that there were no exception have been thrown. So does the index fail affect the insertion?

private IndexResponse insertData(Data data) {
    try {
        IndexRequest indexRequest = new IndexRequest();
        indexRequest.index("index-name");
        indexRequest.id(data.getId());
        Map<String, Object> jsonMap = mapper.convertValue(data, new TypeReference<>() {});
        indexRequest.source(jsonMap);
        return esClient.index(indexRequest, RequestOptions.DEFAULT);
    } catch (Exception ex) {
        log.error("Error: Data={} ", data, ex);
    }
}

In my opinion, I think because the work loads on the ES is high, which cause the replication from primary shard is timeout. Have anyone investigate on this? Thank you!

I have checked these document & threads:


Solution

  • Usually, indexing failures are the result of optimistic concurrency control issues, mapping issues, bad values in your documents (keyword length exceeded, bad date format, etc) or indexing rejections due to sending too many requests (i.e. HTTP 429).

    An open issue shows one of the problem that could cause this, and this error should be seen in your error logs on the client side (i.e. your catch section).