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".
What is wrong with this query? Could this be a bug?