UnsupportedOperationException raised during "DFS query then fetch" with range query in rescorer

Hi,

When I try to run a query with a range query rescorer, Elasticsearch
(version 1.3.2) will raise an java.lang.UnsupportedOperationException
on org.apache.lucene.search.Query.extractTerms. The exact class raising the
exception was NumericRangeQuery in my test.

After some investigations, I found that this occurs when ES try to extract
terms in each rescorer (source
https://github.com/elasticsearch/elasticsearch/blob/v1.3.2/src/main/java/org/elasticsearch/search/dfs/DfsPhase.java#L75).
Everything is working fine for the search query as it is rewritten before
the "extractTerms" method is called (source
https://github.com/elasticsearch/elasticsearch/blob/v1.3.2/src/main/java/org/elasticsearch/search/dfs/DfsPhase.java#L67
).
If I rewrite myself the query as ES would do, everything seems to work
fine. This works because Lucene does not extract terms encapsulated in
filter inside ConstantScoreQuery (source
https://github.com/apache/lucene-solr/blob/lucene_solr_4_9_0/lucene/core/src/java/org/apache/lucene/search/ConstantScoreQuery.java#L98-L103
).

You can find the curl recreation is this gist
: https://gist.github.com/Jdourd/de2ab3f1eb23fe7e06be

Regards,
Gautier

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/86af99b8-84c4-4ef3-97fc-9eb2a3e996b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.