diff --git a/src/main/java/org/elasticsearch/index/percolator/PercolatorQueriesRegistry.java b/src/main/java/org/elasticsearch/index/percolator/PercolatorQueriesRegistry.java index 01c156608f6..b3e7dee940e 100644 --- a/src/main/java/org/elasticsearch/index/percolator/PercolatorQueriesRegistry.java +++ b/src/main/java/org/elasticsearch/index/percolator/PercolatorQueriesRegistry.java @@ -194,14 +194,18 @@ public class PercolatorQueriesRegistry extends AbstractIndexShardComponent { @Override public void created(String type) { + logger.trace("invoking created type listener for index [{}] and shard[{}] on node[{}]", shardId.index(), shardId.id(), nodeName()); if (PercolatorService.TYPE_NAME.equals(type)) { + logger.debug("enabling realtime percolating for index [{}] and shard[{}] on node[{}]", shardId.index(), shardId.id(), nodeName()); enableRealTimePercolator(); } } @Override public void removed(String type) { + logger.trace("invoking removed type listener for index [{}] and shard[{}] on node[{}]", shardId.index(), shardId.id(), nodeName()); if (PercolatorService.TYPE_NAME.equals(type)) { + logger.debug("disabling realtime percolating for index [{}] and shard[{}] on node[{}]", shardId.index(), shardId.id(), nodeName()); disableRealTimePercolator(); clear(); } diff --git a/src/test/java/org/elasticsearch/percolator/PercolatorTests.java b/src/test/java/org/elasticsearch/percolator/PercolatorTests.java index dfbc66d1cb7..d4ed16f8ac4 100644 --- a/src/test/java/org/elasticsearch/percolator/PercolatorTests.java +++ b/src/test/java/org/elasticsearch/percolator/PercolatorTests.java @@ -44,6 +44,7 @@ import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.functionscore.factor.FactorBuilder; import org.elasticsearch.search.highlight.HighlightBuilder; import org.elasticsearch.test.ElasticsearchIntegrationTest; +import org.elasticsearch.test.junit.annotations.TestLogging; import org.junit.Test; import java.util.*; @@ -63,6 +64,7 @@ import static org.hamcrest.Matchers.*; public class PercolatorTests extends ElasticsearchIntegrationTest { @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testSimple1() throws Exception { client().admin().indices().prepareCreate("test").execute().actionGet(); ensureGreen(); @@ -142,6 +144,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testSimple2() throws Exception { client().admin().indices().prepareCreate("index").setSettings( ImmutableSettings.settingsBuilder() @@ -234,6 +237,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testPercolateQueriesWithRouting() throws Exception { client().admin().indices().prepareCreate("test") .setSettings(settingsBuilder().put("index.number_of_shards", 2)) @@ -276,6 +280,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void percolateOnRecreatedIndex() throws Exception { prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute().actionGet(); ensureGreen(); @@ -306,6 +311,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") // see #2814 public void percolateCustomAnalyzer() throws Exception { Builder builder = ImmutableSettings.builder(); @@ -348,6 +354,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void createIndexAndThenRegisterPercolator() throws Exception { assertAcked(client().admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1))); ensureGreen(); @@ -397,6 +404,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void multiplePercolators() throws Exception { client().admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute().actionGet(); ensureGreen(); @@ -438,6 +446,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void dynamicAddingRemovingQueries() throws Exception { client().admin().indices().prepareCreate("test").setSettings(settingsBuilder().put("index.number_of_shards", 1)).execute().actionGet(); ensureGreen(); @@ -510,6 +519,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void percolateWithSizeField() throws Exception { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type1") .startObject("_size").field("enabled", true).field("stored", "yes").endObject() @@ -543,6 +553,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testPercolateStatistics() throws Exception { client().admin().indices().prepareCreate("test").execute().actionGet(); ensureGreen(); @@ -626,6 +637,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testPercolatingExistingDocs() throws Exception { client().admin().indices().prepareCreate("test").execute().actionGet(); ensureGreen(); @@ -700,6 +712,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testPercolatingExistingDocs_routing() throws Exception { client().admin().indices().prepareCreate("test").execute().actionGet(); ensureGreen(); @@ -766,6 +779,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testPercolatingExistingDocs_versionCheck() throws Exception { client().admin().indices().prepareCreate("test").execute().actionGet(); ensureGreen(); @@ -827,6 +841,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testPercolateMultipleIndicesAndAliases() throws Exception { client().admin().indices().prepareCreate("test1") .setSettings(settingsBuilder().put("index.number_of_shards", 2)) @@ -911,6 +926,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testCountPercolation() throws Exception { client().admin().indices().prepareCreate("test").execute().actionGet(); ensureGreen(); @@ -980,6 +996,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testCountPercolatingExistingDocs() throws Exception { client().admin().indices().prepareCreate("test").execute().actionGet(); ensureGreen(); @@ -1042,6 +1059,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testPercolateSizingWithQueryAndFilter() throws Exception { client().admin().indices().prepareCreate("test").execute().actionGet(); ensureGreen(); @@ -1131,6 +1149,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testPercolateScoreAndSorting() throws Exception { client().admin().indices().prepareCreate("my-index") .setSettings(ImmutableSettings.settingsBuilder() @@ -1224,6 +1243,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testPercolateSortingWithNoSize() throws Exception { client().admin().indices().prepareCreate("my-index").execute().actionGet(); ensureGreen(); @@ -1263,6 +1283,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testPercolateOnEmptyIndex() throws Exception { client().admin().indices().prepareCreate("my-index").execute().actionGet(); ensureGreen(); @@ -1277,6 +1298,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testPercolateNotEmptyIndexButNoRefresh() throws Exception { client().admin().indices().prepareCreate("my-index") .setSettings(ImmutableSettings.settingsBuilder().put("index.refresh_interval", -1)) @@ -1466,6 +1488,7 @@ public class PercolatorTests extends ElasticsearchIntegrationTest { } @Test + @TestLogging("index.percolator:TRACE,percolator:TRACE") public void testDeletePercolatorType() throws Exception { DeleteIndexResponse deleteIndexResponse = client().admin().indices().prepareDelete().execute().actionGet(); assertThat("Delete Index failed - not acked", deleteIndexResponse.isAcknowledged(), equalTo(true));