use of org.elasticsearch.action.index.IndexResponse in project elasticsearch-graphite-plugin by spinscale.
the class GraphitePluginIntegrationTest method testThatFieldExclusionWorksWithPrefix.
@Test
public void testThatFieldExclusionWorksWithPrefix() throws Exception {
String prefix = "my.awesome.prefix";
String excludeRegex = prefix + ".node.[http|jvm].*";
node = createNode(clusterName, GRAPHITE_SERVER_PORT, "1s", null, excludeRegex, prefix);
IndexResponse indexResponse = indexElement(node, index, type, "value");
assertThat(indexResponse.getId(), is(notNullValue()));
Thread.sleep(2000);
ensureValidKeyNames();
// ensure no global exclusion
assertGraphiteMetricIsContained(prefix + ".indexes." + index + ".id.0.indexing._all.indexCount 1");
assertGraphiteMetricIsNotContained(prefix + ".node.jvm.threads.peakCount ");
assertGraphiteMetricIsNotContained(prefix + ".node.http.totalOpen ");
}
use of org.elasticsearch.action.index.IndexResponse in project elasticsearch-graphite-plugin by spinscale.
the class GraphitePluginIntegrationTest method testThatFieldInclusionWinsOverExclusion.
@Test
public void testThatFieldInclusionWinsOverExclusion() throws Exception {
String excludeRegex = ".*" + clusterName + ".*";
String includeRegex = ".*\\.peakCount";
node = createNode(clusterName, GRAPHITE_SERVER_PORT, "1s", includeRegex, excludeRegex, null);
IndexResponse indexResponse = indexElement(node, index, type, "value");
assertThat(indexResponse.getId(), is(notNullValue()));
SearchResponse searchResponse = searchElement(node);
assertThat(searchResponse.status(), is(notNullValue()));
Thread.sleep(2000);
ensureValidKeyNames();
assertGraphiteMetricIsNotContained("elasticsearch." + clusterName + ".indexes." + index + ".id.0.indexing._all.indexCount 1");
assertGraphiteMetricIsContained("elasticsearch." + clusterName + ".node.jvm.threads.peakCount ");
}
use of org.elasticsearch.action.index.IndexResponse in project elasticsearch-graphite-plugin by spinscale.
the class GraphitePluginIntegrationTest method testThatFieldExclusionWorks.
@Test
public void testThatFieldExclusionWorks() throws Exception {
String excludeRegex = ".*\\.peakCount";
node = createNode(clusterName, GRAPHITE_SERVER_PORT, "1s", null, excludeRegex, null);
IndexResponse indexResponse = indexElement(node, index, type, "value");
assertThat(indexResponse.getId(), is(notNullValue()));
Thread.sleep(2000);
ensureValidKeyNames();
// ensure no global exclusion
assertGraphiteMetricIsContained("elasticsearch." + clusterName + ".indexes." + index + ".id.0.indexing._all.indexCount 1");
assertGraphiteMetricIsNotContained("elasticsearch." + clusterName + ".node.jvm.threads.peakCount ");
}
use of org.elasticsearch.action.index.IndexResponse in project elasticsearch-opennlp-plugin by spinscale.
the class OpenNlpPluginIntegrationTest method testThatOwnAnalyzersCanBeDefinedPerNlpMappedField.
@Test
public void testThatOwnAnalyzersCanBeDefinedPerNlpMappedField() throws IOException {
putMapping("/test-mapping-analyzers.json");
String sampleText = copyToStringFromClasspath("/sample-text.txt");
IndexResponse indexResponse = indexElement(sampleText);
SearchResponse nonAnalyzedFieldSearchResponse = query(QueryBuilders.termQuery("someField.name", "jack"));
assertThat(nonAnalyzedFieldSearchResponse.getHits().totalHits(), is(1L));
// analyzed, therefore not resulting anything like the above query
SearchResponse analyzedFieldSearchResponse = query(QueryBuilders.termQuery("someFieldAnalyzed.name", "jack"));
assertThat(analyzedFieldSearchResponse.getHits().totalHits(), is(0L));
SearchResponse searchResponse = query(QueryBuilders.prefixQuery("someFieldAnalyzed.name", "Jack"));
assertThat(searchResponse.getHits().totalHits(), is(1L));
searchResponse = query(QueryBuilders.matchQuery("someFieldAnalyzed.name", "Jack Nicholson"));
assertThat(searchResponse.getHits().totalHits(), is(1L));
assertThat(searchResponse.getHits().getAt(0).id(), is(indexResponse.getId()));
}
use of org.elasticsearch.action.index.IndexResponse in project elasticsearch-opennlp-plugin by spinscale.
the class OpenNlpPluginIntegrationTest method indexElement.
private IndexResponse indexElement(String value) {
IndexResponse indexResponse = node.client().prepareIndex(index, type).setSource("someFieldAnalyzed", value, "someField", value).setRefresh(true).execute().actionGet();
assertThat(indexResponse.getId(), is(notNullValue()));
return indexResponse;
}
Aggregations