/** * Return the detail message, including the message from the nested exception * if there is one. */ public String getDetailedMessage() { if (getCause() != null) { StringBuilder sb = new StringBuilder(); sb.append(toString()).append("; "); if (getCause() instanceof ElasticsearchException) { sb.append(((ElasticsearchException) getCause()).getDetailedMessage()); } else { sb.append(getCause()); } return sb.toString(); } else { return super.toString(); } }
@Override protected ShardValidateQueryResponse shardOperation(ShardValidateQueryRequest request, Task task) throws IOException { boolean valid; String explanation = null; String error = null; ShardSearchLocalRequest shardSearchLocalRequest = new ShardSearchLocalRequest(request.shardId(), request.types(), request.nowInMillis(), request.filteringAliases()); SearchContext searchContext = searchService.createSearchContext(shardSearchLocalRequest, SearchService.NO_TIMEOUT); try { ParsedQuery parsedQuery = searchContext.getQueryShardContext().toQuery(request.query()); searchContext.parsedQuery(parsedQuery); searchContext.preProcess(request.rewrite()); valid = true; explanation = explain(searchContext, request.rewrite()); } catch (QueryShardException|ParsingException e) { valid = false; error = e.getDetailedMessage(); } catch (AssertionError e) { valid = false; error = e.getMessage(); } finally { Releasables.close(searchContext); } return new ShardValidateQueryResponse(request.shardId(), valid, explanation, error); }
private static void handleFailure(final Handler<AsyncResult<JsonObject>> resultHandler, final Throwable t) { if (t instanceof ElasticsearchException) { final ElasticsearchException esException = (ElasticsearchException) t; resultHandler.handle(Future.failedFuture(esException.getDetailedMessage())); } else { resultHandler.handle(Future.failedFuture(t)); } }
/** * Return the detail message, including the message from the nested exception * if there is one. */ public String getDetailedMessage() { if (getCause() != null) { StringBuilder sb = new StringBuilder(); sb.append(toString()).append("; "); if (getCause() instanceof ElasticsearchException) { sb.append(((ElasticsearchException) getCause()).getDetailedMessage()); } else { sb.append(getCause()); } return sb.toString(); } else { return super.toString(); } }
/** * Return the detail message, including the message from the nested exception * if there is one. */ public String getDetailedMessage() { if (getCause() != null) { StringBuilder sb = new StringBuilder(); sb.append(toString()).append("; "); if (getCause() instanceof ElasticsearchException) { sb.append(((ElasticsearchException) getCause()).getDetailedMessage()); } else { sb.append(getCause()); } return sb.toString(); } else { return super.toString(); } }
/** * Return the detail message, including the message from the nested exception * if there is one. */ public String getDetailedMessage() { if (getCause() != null) { StringBuilder sb = new StringBuilder(); sb.append(toString()).append("; "); if (getCause() instanceof ElasticsearchException) { sb.append(((ElasticsearchException) getCause()).getDetailedMessage()); } else { sb.append(getCause()); } return sb.toString(); } else { return super.toString(); } }
/** * Return the detail message, including the message from the nested exception * if there is one. */ public String getDetailedMessage() { if (getCause() != null) { StringBuilder sb = new StringBuilder(); sb.append(toString()).append("; "); if (getCause() instanceof ElasticsearchException) { sb.append(((ElasticsearchException) getCause()).getDetailedMessage()); } else { sb.append(getCause()); } return sb.toString(); } else { return super.toString(); } }
@Override protected ShardValidateQueryResponse shardOperation(ShardValidateQueryRequest request) throws IOException { boolean valid; String explanation = null; String error = null; ShardSearchLocalRequest shardSearchLocalRequest = new ShardSearchLocalRequest(request.shardId(), request.types(), request.nowInMillis(), request.filteringAliases()); SearchContext searchContext = searchService.createSearchContext(shardSearchLocalRequest, SearchService.NO_TIMEOUT, null); try { ParsedQuery parsedQuery = searchContext.getQueryShardContext().toQuery(request.query()); searchContext.parsedQuery(parsedQuery); searchContext.preProcess(request.rewrite()); valid = true; explanation = explain(searchContext, request.rewrite()); } catch (QueryShardException|ParsingException e) { valid = false; error = e.getDetailedMessage(); } catch (AssertionError|IOException e) { valid = false; error = e.getMessage(); } finally { Releasables.close(searchContext); } return new ShardValidateQueryResponse(request.shardId(), valid, explanation, error); }
@Override protected ShardValidateQueryResponse shardOperation(ShardValidateQueryRequest request, Task task) throws IOException { boolean valid; String explanation = null; String error = null; ShardSearchLocalRequest shardSearchLocalRequest = new ShardSearchLocalRequest(request.shardId(), request.types(), request.nowInMillis(), request.filteringAliases()); SearchContext searchContext = searchService.createSearchContext(shardSearchLocalRequest, SearchService.NO_TIMEOUT); try { ParsedQuery parsedQuery = searchContext.getQueryShardContext().toQuery(request.query()); searchContext.parsedQuery(parsedQuery); searchContext.preProcess(request.rewrite()); valid = true; explanation = explain(searchContext, request.rewrite()); } catch (QueryShardException|ParsingException e) { valid = false; error = e.getDetailedMessage(); } catch (AssertionError e) { valid = false; error = e.getMessage(); } finally { Releasables.close(searchContext); } return new ShardValidateQueryResponse(request.shardId(), valid, explanation, error); }
@Override protected ShardValidateQueryResponse shardOperation(ShardValidateQueryRequest request, Task task) throws IOException { boolean valid; String explanation = null; String error = null; ShardSearchLocalRequest shardSearchLocalRequest = new ShardSearchLocalRequest(request.shardId(), request.types(), request.nowInMillis(), request.filteringAliases()); SearchContext searchContext = searchService.createSearchContext(shardSearchLocalRequest, SearchService.NO_TIMEOUT); try { ParsedQuery parsedQuery = searchContext.getQueryShardContext().toQuery(request.query()); searchContext.parsedQuery(parsedQuery); searchContext.preProcess(request.rewrite()); valid = true; explanation = explain(searchContext, request.rewrite()); } catch (QueryShardException|ParsingException e) { valid = false; error = e.getDetailedMessage(); } catch (AssertionError|IOException e) { valid = false; error = e.getMessage(); } finally { Releasables.close(searchContext); } return new ShardValidateQueryResponse(request.shardId(), valid, explanation, error); }