If only year, month, day are relevant to your situation, index the text string "YYYYMMDD" as Field.Keyword(String, String), rather than using DateField or Field.Keyword(String, Date). Why? Because RangeQuery will expand into a BooleanQuery of all terms in the range, and DateField represents down to the millisecond level and can expand into more terms than are allowed in a BooleanQuery.

Another reason to do this is that you will be able to index dates before the Unix Epoch (Jan 1, 1970) which DateField cannot handle.

  • No labels