我可以使用Python加载来自CSV文件的所有文档

发布于 2025-01-31 11:15:27 字数 666 浏览 2 评论 0原文

我正在尝试使用Python加载CSV文件到Elasticsearch,

from elasticsearch import Elasticsearch, helpers
import csv

# Elastic search configuation

es = Elasticsearch('http://IP:8081')

# Creating index
es.indices.create(index="suivipsi")

# Looking if the index exists
#es.indices.exists(index="firstindex")

# Open csv file and bulk upload
  with open('Suivi_des_PSI_2.csv',encoding='utf-8') as f:
    reader = csv.DictReader(f)
    helpers.bulk(es, reader, index='suivipsi')

当我的CSV文件Hase 8763 Line Bunt在Elasticsearch中创建索引时,只有将334个木质加载到索引 如下所示 在此处输入图像描述

i'm trying to load csv file to Elasticsearch using python

from elasticsearch import Elasticsearch, helpers
import csv

# Elastic search configuation

es = Elasticsearch('http://IP:8081')

# Creating index
es.indices.create(index="suivipsi")

# Looking if the index exists
#es.indices.exists(index="firstindex")

# Open csv file and bulk upload
  with open('Suivi_des_PSI_2.csv',encoding='utf-8') as f:
    reader = csv.DictReader(f)
    helpers.bulk(es, reader, index='suivipsi')

my csv file hase 8763 line bunt when index is created in elasticsearch it gives that only 334 lignes are loaded to index
as shown below
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文