예제 #1
0
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))
예제 #2
0
def run(args):
    es = es_client()

    results = es.search(index=INDEX_NAME, doc_type='cards', body=QUERY_BODY)

    print(results['hits']['total'])
예제 #3
0
def run(args):
    es = es_client()

    results = es.search(index=INDEX_NAME, doc_type='cards', body=AGGREGATION)

    print(results)
예제 #4
0
파일: question3.py 프로젝트: mattir/es4mc
def run(args):
    es = es_client()