Get paths from ES
Fix errors, optimize query