ElasticsearchIndexer implements Indexer { @Override public boolean tag(Project prj, String documentId, String rootDocument, Tag... tags) throws IOException { return tagUntag(prj, documentId, rootDocument, createTagScript(tags)); } @Inject  ElasticsearchIndexer(final RestHighLevelClient esClient, final PropertiesProvider propertiesProvider); @Override void close(); @Override boolean bulkAdd(final String indexName, Pipeline.Type nerType, List<NamedEntity> namedEntities, Document parent); @Override boolean bulkUpdate(String indexName, List<? extends Entity> entities); @Override void add(final String indexName, T obj); @Override void update(String indexName, T obj); @Override String executeRaw(String method, String url, String rawJson); T get(String indexName, String id); @Override T get(String indexName, String id, String root); @Override boolean tag(Project prj, String documentId, String rootDocument, Tag... tags); @Override boolean untag(Project prj, String documentId, String rootDocument, Tag... tags); @Override boolean tag(Project prj, List<String> documentIds, Tag... tags); @Override boolean untag(Project prj, List<String> documentIds, Tag... tags); @Override Searcher search(final String indexName, Class<? extends Entity> entityClass); @Override boolean createIndex(final String indexName); @Override boolean deleteAll(String indexName); ElasticsearchIndexer withRefresh(WriteRequest.RefreshPolicy refresh); @Override boolean getHealth(); final RestHighLevelClient client; }
@Test(expected = ElasticsearchStatusException.class) public void test_tag_unknown_document() throws IOException { indexer.tag(project(TEST_INDEX), "unknown", "routing", tag("foo"), tag("bar")); }