TypeError:ElasticSearch中的字符串索引必须是整数

56lgkhnf  于 2022-11-22  发布在  ElasticSearch
关注(0)|答案(1)|浏览(154)

我正在学习EalsticSearch教程(https://soumilshah1995.blogspot.com/2020/01/getting-started-with-elastic-search-and.html),但在尝试执行

es.indices.create(index='person', ignore=400)

res1 = es.index(index='person',doc_type='people', body=e1)
res2 = es.index(index='person',doc_type='people', body=e2)

print("RES1 : {}".format(res1))
print("RES2 : {}".format(res2))

我已经将我的Elasticsearch降级为elasticsearch==5.5.3,但仍然遇到同样的错误。
能帮上忙就好了

44u64gxh

44u64gxh1#

我刚刚将Elasticsearch升级到最新版本,并将代码的格式更改为:

es.indices.create(index='person', ignore=400)

res1 = es.index(index="person", id=1, document=e1)
res2= es.index(index="person", id=1, document=e1)

print("RES1 : {}".format(res1))
print("RES2 : {}".format(res2))

相关问题