我正在使用本机排序脚本&希望在其中反序列化源文档(以访问多级嵌套对象)。我可以使用
SourceLookup source = source(); 它给了我字节
byte[] bytes = source.internalSourceRef().toBytes()这些字节的序列化格式是什么,如何将其反序列化?此外,执行此操作的性能考虑是什么?是否需要对每个文档进行磁盘访问?
发布于 2016-01-05 04:58:52
通过查看SourceLookup的源代码,您可以了解更多关于在那里可以找到什么的信息。该字节数组基本上是一个表示文档源的序列化Map (可能是压缩的)。
使用它的方法是在获取的source()引用上再次调用source,以便检索底层Map
SourceLookup source = source();
// number of keys in the map
int size = source.size();
// retrieve the content of the source
Map<String, Object> map = source.source();
// use the source maphttps://stackoverflow.com/questions/34598217
复制相似问题