Hello
Recently we added APM to our application. I saw that APM capture as error all request to elasticsearch that give a 404 as response. To be exact, ResponseException.
I'm trying to avoid that because when I see APM errors and see so much errors I'm scared thinking something goes wrong.
I tried catching exception in client get request on java rest high client but none exception is throwed in code. Also, in documentation says that to check if document exists (found) use method isExists() that it's as we are doing.
String index = getResponse.getIndex();
String id = getResponse.getId();
/*Handle the scenario where the document was not found. Note that although the returned
response has `404` status code, a valid `GetResponse` is returned rather than an exception thrown.
Such response does not hold any source document and its `isExists` method returns `false` */
if (getResponse.isExists()) {
long version = getResponse.getVersion();
String sourceAsString = getResponse.getSourceAsString();
Map<String, Object> sourceAsMap = getResponse.getSourceAsMap();
byte[] sourceAsBytes = getResponse.getSourceAsBytes();
} else {
}
I guess the only way to avoid that is with another request before get using exists API to check if document exists, but if there is any option to avoid capture that exception I prefer that.
So my question is: Is there any configuration to avoid capture this exception from apm java agent or in code?
Thanks in advance,
Adrián.