Problems with refactoring FieldCache to DocValues


#1

I'm currently refacoring from ES 1.5 to ES 2.4. But I encounter some problems with the removal of the FieldCache in Lucene 5.

Steps taken:

  1. added the doc_value:true in the mapping (fieldtype is string)
  2. Rebuild the index completely
  3. Load the docvalues in the doSetNextReader(LeafReaderContext context) from a custom collector class like this
BinaryDocValues  sids = DocValues.getBinary(context.reader(), "id");

or like this

BinaryDocValues ids = context.reader().getBinaryDocValues("id");

but in both cases I get the following exception:

RemoteTransportException[[ws6711][79.99.188.47:9300][geohashcluster[s]]]; nested: IllegalStateException[unexpected docvalues type SORTED_SET for field 'id' (expected one of [BINARY, SORTED]). Use UninvertingReader or index with docvalues.];
Caused by: java.lang.IllegalStateException: unexpected docvalues type SORTED_SET for field 'id' (expected one of [BINARY, SORTED]). Use UninvertingReader or index with docvalues.
	at org.apache.lucene.index.DocValues.checkField(DocValues.java:208)
	at org.apache.lucene.index.DocValues.getBinary(DocValues.java:247)
	at org.elasticsearch.action.geohashcluster.GeohashClusterCollector.doSetNextReader(GeohashClusterCollector.java:153)
	at org.apache.lucene.search.SimpleCollector.getLeafCollector(SimpleCollector.java:33)
	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:812)
	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:535)
	at org.elasticsearch.action.geohashcluster.TransportGeohashClusterAction.shardOperation(TransportGeohashClusterAction.java:292)
	at org.elasticsearch.action.geohashcluster.TransportGeohashClusterAction.shardOperation(TransportGeohashClusterAction.java:59)
	at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:282)
	at org.elasticsearch.action.support.broadcast.TransportBroadcastAction$ShardTransportHandler.messageReceived(TransportBroadcastAction.java:278)
	at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:77)
	at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

Does anyone know what I'm doing wrong?


#2

I've found the problem, apparently I should use it like this:

SortedSetDocValues ids = context.reader().getSortedSetDocValues("id");

Why does this work and the BinaryDocValues doesn't?


(system) #3