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
Quoted query_string gives NullPointerException with not_analyzed field (0.19.4) #2006
Comments
I think I fixed it in a recent commit to 0.19 branch, si there a chance for a full recreation to verify it? |
I ran our software tests with the latest 0.19 (0.19.5-SNAPSHOT). I also tried the master (0.20.0.Beta1-SNAPSHOT). Exception message: The query that failed: { |
can you provide a curl based recreation? Including setting up the index, indexing some sample data, and search that shows the failure? |
I'm going on a Holiday now, but I have informed my colleagues about this. |
…d (0.19.4), closes elastic#2006.
…d (0.19.4), closes elastic#2006.
After upgrading from Elasticsearch 0.19.2 to 0.19.4 this query failes:
{
"from" : 0,
"size" : 100000,
"query" : {
"query_string" : {
"query" : ""oai:bibsys.no:biblio:92116324x" "oai:bibsys.no:biblio:101924739" "oai:bibsys.no:biblio:921163258" "oai:bibsys.no:biblio:09372229x" "oai:bibsys.no:biblio:921163259" ",
"fields" : [ "otherid", "oaiid", "sesamid", "isbn", "urn" ]
}
},
"explain" : false,
"sort" : [ {
"_id" : {
"order" : "asc"
}
} ]
}
What we want, is to use the query_string to get the exact match.
Mappings:
"otherid":{"type":"string"},
"isbn":{"type":"string", "analyzer":"isbn"},
"urn":{"type":"string", "index":"not_analyzed", "boost":2.0},
"sesamid":{"type":"string", "index":"not_analyzed"},
"oaiid":{"type":"string", "index":"not_analyzed", "boost":2.0},
Elasticsearch log:
Parse Failure [Failed to parse source [{"from":0,"size":100000,"query":{"query_string":{"query":""oai:bibsys.no:biblio:92116324x" "oai:bibsys.no:biblio:101924739" "oai:bibsys.no:biblio:921163258" "oai:bibsys.no:biblio:09372229x" "oai:bibsys.no:biblio:921163259" ","fields":["otherid","oaiid","sesamid","isbn","urn"]}},"explain":false,"sort":[{"_id":{"order":"asc"}}]}]]
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:557)
at org.elasticsearch.search.SearchService.createContext(SearchService.java:469)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:228)
at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:497)
at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:486)
at org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler.run(MessageChannelHandler.java:373)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.NullPointerException
at org.elasticsearch.index.mapper.MapperService$SmartIndexNameSearchQuoteAnalyzer.reusableTokenStream(MapperService.java:976)
at org.apache.lucene.queryParser.QueryParser.getFieldQuery(QueryParser.java:574)
at org.apache.lucene.queryParser.MapperQueryParser.getFieldQuerySingle(MapperQueryParser.java:238)
at org.apache.lucene.queryParser.MapperQueryParser.getFieldQuery(MapperQueryParser.java:186)
at org.apache.lucene.queryParser.QueryParser.getFieldQuery(QueryParser.java:752)
at org.apache.lucene.queryParser.MapperQueryParser.getFieldQuery(MapperQueryParser.java:257)
at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1580)
at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1317)
at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1245)
at org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1234)
at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:206)
at org.elasticsearch.index.query.QueryStringQueryParser.parse(QueryStringQueryParser.java:206)
at org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:187)
at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:249)
at org.elasticsearch.index.query.IndexQueryParserService.parse(IndexQueryParserService.java:229)
at org.elasticsearch.search.query.QueryParseElement.parse(QueryParseElement.java:33)
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:545)
As you can see we get a NullPointerException in MapperService(976) which is new code in 0.19.4. It looks like it has something to do with the searchQuoteAnalyzer().
If we remove the quotes(") around each query string, this query runs fine, but we get more hits then we want to. I guess, this is because "otherid" is not set to "not_analyzed".
Another query that also generate the same NPE:
{
"size": 1000,
"query": {
"bool": {
"must": [
{
"bool": {
"must": [
{
"field": {
"title": ""Flammekaster""
}
},
{
"field": {
"creator": ""Dalby, Gene""
}
},
{
"field": {
"year": ""1981""
}
},
{
"field": {
"mediatype": ""Bøker""
}
}
]
}
},
{
"field": {
"status": "PROCESSED INDEXED FIELDS_EXTRACTED"
}
}
]
}
},
"fields": [
"title",
"creator",
"isbn",
"year",
"mediatype"
],
"sort": [
{
"dedup_primarySourceScore": {
"order": "desc"
}
},
{
"dedup_modsSize": {
"order": "desc"
}
},
{
"oaiid": {
"order": "asc"
}
}
]
}
The text was updated successfully, but these errors were encountered: