На самом деле существует простое решение, которое выглядит так:
from elasticsearch import Elasticsearch as ES
from copy import deepcopy as copy
import sys
_field = sys.argv[1]
_terms = sys.argv[2:]
_timeout = 60
_gate = 'some.gate.org/'
_index = 'some_index'
_client = ES([_gate],scheme='http',port=80,timeout=_timeout) #or however to get connection
_body= {"doc": {_field: None}, "term_statistics" : True, "field_statistics" : True, "positions": False, "offsets": False}
for term in terms_:
body = copy(_body); body["doc"][_field] = term
result = _client.termvectors(index=_index,body=body)
print 'documents with', term, ':', result['term_vectors'][_field]['terms'][term]['doc_freq']
print 'frequency of ', term, ':', result['term_vectors'][_field]['terms'][term]['ttf']