Skip to content

Commit

Permalink
Add test that reproduces issue elastic#5049
Browse files Browse the repository at this point in the history
Test for elastic#5049, the test doesn't fail but it generates AssertError in the log while running
  • Loading branch information
imotov committed Feb 7, 2014
1 parent 6777be6 commit a029b81
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/test/java/org/elasticsearch/percolator/PercolatorTests.java
Expand Up @@ -1536,6 +1536,30 @@ public boolean apply(Object o) {
assertMatchCount(response, 0l);
}

@Test
public void percolateNonMatchingConstantScoreQuery() throws Exception {
assertAcked(client().admin().indices().prepareCreate("test"));
ensureGreen();

logger.info("--> register a query");
client().prepareIndex("test", PercolatorService.TYPE_NAME, "1")
.setSource(jsonBuilder().startObject()
.field("query", QueryBuilders.constantScoreQuery(FilterBuilders.andFilter(
FilterBuilders.queryFilter(QueryBuilders.queryString("root")),
FilterBuilders.termFilter("message", "tree"))))
.endObject())
.setRefresh(true)
.execute().actionGet();

PercolateResponse percolate = client().preparePercolate()
.setIndices("test").setDocumentType("doc")
.setSource(jsonBuilder().startObject()
.startObject("doc").field("message", "A new bonsai tree ").endObject()
.endObject())
.execute().actionGet();
assertMatchCount(percolate, 0l);
}

public static String[] convertFromTextArray(PercolateResponse.Match[] matches, String index) {
if (matches.length == 0) {
return Strings.EMPTY_ARRAY;
Expand Down

0 comments on commit a029b81

Please sign in to comment.