elasticsearch indexing and querying code from ddr-local