# Python query script that reads all ES records on the l2b server, stores them in a dictionary and prints it.

from elasticsearch import Elasticsearch
import certifi
import datetime
import calendar
#import requests
#res = requests.get('https://edge:spinbolnorv7@opsdash.deflect.ca:443')
#print res.content
import pdb
#pdb.set_trace()

es = Elasticsearch(
    '[...]',
    # name of node to be added here 'http(s)://user:password@server:port']
    port= #add the port number,
    use_ssl=True,
    verify_certs=True,
    ca_certs=certifi.where()
)

def query_result(interval, start, end):
    return es.search(index="", body =
                     #add index between the quotation marks
{
  "from" : 0, "size" : 10000,
  #the size can be changed but apparently the current query does not show > 10000 results. 
  "query": {
   "bool": {
      "must": { "match_all": {} },
        "filter": {
          "range": {
            "@timestamp": {
               "gte": 1451566081000,
               "lte": 1451566082001,
               #timestamps are for start/end date in epoch format. this format should be changed for other dates (current one is for 31.12.2015)
               "format": "epoch_millis"
               #format could be changed, but for now keeping the epoch + millisecond one
          }
        }
      }
    }
  }
})

#print len(query_result(0,0,0))
print query_result(0,0,0)

@@ -194,144 +194,8 @@
 ndar
-%0A#import requests%0A#res = requests.get('https://edge:spinbolnorv7@opsdash.deflect.ca:443')%0A#print res.content%0Aimport pdb%0A#pdb.set_trace()
 %0A%0Aes

Update es_to_python.py