使用较低级的
elasticsearch-py库,这种任务比较容易:
from elasticsearch import helpers, Elasticsearchimport csves = Elasticsearch()with open('/tmp/x.csv') as f: reader = csv.DictReader(f) helpers.bulk(es, reader, index='my-index', doc_type='my-type')
使用较低级的
elasticsearch-py库,这种任务比较容易:
from elasticsearch import helpers, Elasticsearchimport csves = Elasticsearch()with open('/tmp/x.csv') as f: reader = csv.DictReader(f) helpers.bulk(es, reader, index='my-index', doc_type='my-type')