Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException for invalid faceted query #1136

Closed
deverton opened this issue Jul 20, 2011 · 1 comment
Closed

NullPointerException for invalid faceted query #1136

deverton opened this issue Jul 20, 2011 · 1 comment

Comments

@deverton
Copy link
Contributor

I stuffed up while writing a simple faceted query for the top three terms and got an NPE from Elasticsearch rather than the expected "invalid query" error.

Stack Trace
Test case

This is on Elasticsearch 0.17.0. On ES 0.16.0 I get

{
  "error" : "SearchPhaseExecutionException[Failed to execute phase [query], total failure; shardFailures {[_na_][testindex][0]: No active shards}{[_na_][testindex][1]: No active shards}{[_na_][testindex][2]: No active shards}{[_na_][testindex][3]: No active shards}{[_na_][testindex][4]: No active shards}]",
  "status" : 500
}

instead.
@kimchy
Copy link
Member

kimchy commented Jul 20, 2011

It fails because the facet is not formatted correctly, I will push a better failure message in this case. Here is how it should look like (note the terms type):

curl -XPOST http://localhost:9200/testindex/_search?pretty=true -d '{
    "query" : { "match_all" : {} },
    "facets" : {
        "tags" : {
            "terms" : {
                "field" : "tag",
                "size" : 3
            }
        }
    }
}'

@kimchy kimchy closed this as completed in 0ed50ca Jul 20, 2011
ofavre pushed a commit to yakaz/elasticsearch that referenced this issue Jul 21, 2011
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
williamrandolph pushed a commit to williamrandolph/elasticsearch that referenced this issue Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants