Navigation Menu

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

Exists filter throws NullPointerException on empty index #12572

Closed
SergVro opened this issue Jul 31, 2015 · 2 comments
Closed

Exists filter throws NullPointerException on empty index #12572

SergVro opened this issue Jul 31, 2015 · 2 comments
Labels
>bug help wanted adoptme :Search/Search Search-related issues that do not fall into other categories

Comments

@SergVro
Copy link

SergVro commented Jul 31, 2015

In 1.7.1
Using Filtered query with Exists filter causes SearchParseException on an empty index.

Steps to reproduce:

# make sure there is no such index
curl -XDELETE localhost:9200/test_index

# create a new index
curl -XPUT localhost:9200/test_index

# issue a query with Exists Filter
curl -XGET localhost:9200/test_index/_search -d '
{
    "query": {
        "filtered": {
           "query": {
           "match_all": {}
           },
           "filter": {
               "exists": {
                  "field": "user"
               }
           }
        }
    }
}
'

Stack trace:

org.elasticsearch.search.SearchParseException: [test_index][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [{
    "query": {
        "filtered": {
           "query": {
           "match_all": {}
           },
           "filter": {
               "exists": {
                  "field": "user"
               }
           }
        }
    }
}
]]
    at org.elasticsearch.search.SearchService.parseSource(SearchService.java:747)
    at org.elasticsearch.search.SearchService.createContext(SearchService.java:572)
    at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:544)
    at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:306)
    at org.elasticsearch.search.action.SearchServiceTransportAction$5.call(SearchServiceTransportAction.java:231)
    at org.elasticsearch.search.action.SearchServiceTransportAction$5.call(SearchServiceTransportAction.java:228)
    at org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:559)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
    at org.elasticsearch.index.query.ExistsFilterParser.newFilter(ExistsFilterParser.java:87)
    at org.elasticsearch.index.query.ExistsFilterParser.parse(ExistsFilterParser.java:82)
    at org.elasticsearch.index.query.QueryParseContext.executeFilterParser(QueryParseContext.java:371)
    at org.elasticsearch.index.query.QueryParseContext.parseInnerFilter(QueryParseContext.java:352)
    at org.elasticsearch.index.query.FilteredQueryParser.parse(FilteredQueryParser.java:74)
    at org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:305)
    at org.elasticsearch.index.query.IndexQueryParserService.innerParse(IndexQueryParserService.java:382)
    at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:281)
    at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:276)
    at org.elasticsearch.search.query.QueryParseElement.parse(QueryParseElement.java:33)
    at org.elasticsearch.search.SearchService.parseSource(SearchService.java:731)
    ... 9 more
@colings86 colings86 added >bug v2.0.0-beta1 :Search/Search Search-related issues that do not fall into other categories help wanted adoptme labels Jul 31, 2015
@colings86
Copy link
Contributor

This has been fixed in 2.0

@SergVro
Copy link
Author

SergVro commented Aug 4, 2015

We can't use 2.0, that's why I need this fixed in 1.6 or 1.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug help wanted adoptme :Search/Search Search-related issues that do not fall into other categories
Projects
None yet
Development

No branches or pull requests

3 participants