def run(args): es = es_client() # don't hate me because I'm mutable INDEX_MAPPINGS['mappings']['cards']['properties'].update(NEW_FIELDS) if es.indices.exists(INDEX_NAME): es.indices.delete(index=INDEX_NAME) idx = merge_two_dicts(INDEX_MAPPINGS, INDEX_SETTINGS) es.indices.create(index=INDEX_NAME, body=idx) card_iter = helpers.scan(es, index='mtg') helpers.bulk(es, enriched_card_iter(card_iter))
def run(args): es = es_client() results = es.search(index=INDEX_NAME, doc_type='cards', body=QUERY_BODY) print(results['hits']['total'])
def run(args): es = es_client() results = es.search(index=INDEX_NAME, doc_type='cards', body=AGGREGATION) print(results)
def run(args): es = es_client()