Hi,
We seem to have stumbled on some issue while running queries against a 
local elasticsearch node under a JUnit test.

We've been able to create a small test case which demonstrates this.

The necessary prerequisites for the failure:

* 2 or more shards
* Any of the DFS search types
* A terms facet on a field with a "long" type in the mapping

We have tested it with elasticsearch 0.90.x, and different versions of java.

It doesn't always fail, e.g. we have one machine with an old java version 
(1.7.0_07) where it works in IntelliJ, but not in maven. 

When we run the test against the master-branch the test works, but not on 
the 0.90-branch.

```
public class MyTest {
    private Client client;

    @Before
    public void createNode() throws Exception {
        Settings nodeSettings = ImmutableSettings.settingsBuilder()
                .put("node.local", false)
                .put("path.data", "./target/elasticsearch-test/data")
                .put("path.work", "./target/elasticsearch-test/work")
                .put("path.logs", "./target/elasticsearch-test/logs")
                .put("index.number_of_shards", "2")
                .build();

        Node node = NodeBuilder.nodeBuilder().settings(nodeSettings).node();
        client = node.client();
    }

    @After
    public void cleanup() throws Exception {
        FileSystemUtils.deleteRecursively(new 
File("./target/elasticsearch-test/"), true);
    }

    @Test
    public void demonstrateFailure() throws Exception {

        IndexResponse indexResponse = client
                .prepareIndex("test-index", "test-type")
                .setSource("{ \"id\": 123, \"test-value\": 321 }")
                .setRefresh(true)
                .execute()
                .actionGet();

        SearchResponse searchResponse = client
                .prepareSearch("test-index")
                .setQuery(new MatchAllQueryBuilder())
                .addFacet(new 
TermsFacetBuilder("test-facet").field("test-value"))
                .setSearchType(SearchType.DFS_QUERY_AND_FETCH)
                .execute()
                .actionGet();

        System.out.println(searchResponse);

        assertEquals(searchResponse.getFailedShards(), 0); // Failing!
    }
}
```

Output from a failed run:

```
{
  "took" : 68,
  "timed_out" : false,
  "_shards" : {
    "total" : 2,
    "successful" : 0,
    "failed" : 2,
    "failures" : [ {
      "index" : "test-index",
      "shard" : 0,
      "status" : 500,
      "reason" : "ElasticSearchException; nested: AssertionError; "
    }, {
      "index" : "test-index",
      "shard" : 1,
      "status" : 500,
      "reason" : "ElasticSearchException; nested: AssertionError; "
    } ]
  },
  "hits" : {
    "total" : 0,
    "max_score" : 0.0,
    "hits" : [ ]
  }
}
```

--

Regards,
Henrik Nordvik

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/b511afef-4461-477e-a46f-5c3c7f9cdedd%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to