Search in sources :

Example 11 with ResourceNotFoundException

use of org.elasticsearch.ResourceNotFoundException in project elasticsearch by elastic.

the class StoredScriptTests method testInvalidDelete.

public void testInvalidDelete() {
    ResourceNotFoundException rnfe = expectThrows(ResourceNotFoundException.class, () -> ScriptMetaData.deleteStoredScript(null, "test", "lang"));
    assertThat(rnfe.getMessage(), equalTo("stored script [test] using lang [lang] does not exist and cannot be deleted"));
    rnfe = expectThrows(ResourceNotFoundException.class, () -> ScriptMetaData.deleteStoredScript(null, "test", null));
    assertThat(rnfe.getMessage(), equalTo("stored script [test] does not exist and cannot be deleted"));
}
Also used : ResourceNotFoundException(org.elasticsearch.ResourceNotFoundException)

Example 12 with ResourceNotFoundException

use of org.elasticsearch.ResourceNotFoundException in project elasticsearch by elastic.

the class PercolateQueryBuilderTests method testIndexedDocumentDoesNotExist.

public void testIndexedDocumentDoesNotExist() throws IOException {
    indexedDocumentExists = false;
    PercolateQueryBuilder pqb = doCreateTestQueryBuilder(true);
    ResourceNotFoundException e = expectThrows(ResourceNotFoundException.class, () -> pqb.rewrite(createShardContext()));
    String expectedString = "indexed document [" + indexedDocumentIndex + "/" + indexedDocumentType + "/" + indexedDocumentId + "] couldn't be found";
    assertThat(e.getMessage(), equalTo(expectedString));
}
Also used : ResourceNotFoundException(org.elasticsearch.ResourceNotFoundException)

Aggregations

ResourceNotFoundException (org.elasticsearch.ResourceNotFoundException)12 IOException (java.io.IOException)4 ElasticsearchException (org.elasticsearch.ElasticsearchException)4 BytesArray (org.elasticsearch.common.bytes.BytesArray)4 GetRequest (org.elasticsearch.action.get.GetRequest)3 GetResponse (org.elasticsearch.action.get.GetResponse)3 DeletePipelineRequest (org.elasticsearch.action.ingest.DeletePipelineRequest)3 ClusterName (org.elasticsearch.cluster.ClusterName)3 ClusterState (org.elasticsearch.cluster.ClusterState)3 XContentParser (org.elasticsearch.common.xcontent.XContentParser)3 HashMap (java.util.HashMap)2 IndexNotFoundException (org.elasticsearch.index.IndexNotFoundException)2 TaskResult (org.elasticsearch.tasks.TaskResult)2 TransportException (org.elasticsearch.transport.TransportException)2 FileNotFoundException (java.io.FileNotFoundException)1 BrokenBarrierException (java.util.concurrent.BrokenBarrierException)1 ElasticsearchStatusException (org.elasticsearch.ElasticsearchStatusException)1 ElasticsearchTimeoutException (org.elasticsearch.ElasticsearchTimeoutException)1 ExceptionsHelper (org.elasticsearch.ExceptionsHelper)1 ResourceAlreadyExistsException (org.elasticsearch.ResourceAlreadyExistsException)1