当我尝试使用opensearch-py在AWS Opensearch服务(ElasticSearch V 10.1)上进行批量索引时,我遇到以下错误
RequestError: RequestError(400, 'illegal_argument_exception', 'explicit index in bulk is not allowed')
from opensearchpy.helpers import bulk
bulk(client, format_embeddings_for_es_indexing(embd_data, titles_, _INDEX_))
- es_indexing()的格式嵌入**函数生成
{
'_index': 'test_v1',
'_id': '208387',
'_source': {
'article_id': '208387',
'title': 'Battery and Performance',
'title_vector': [ 1.77665558e-02, 1.95874255e-02,.....],
......
}
}
我可以使用'open search.index()'逐个索引文档
failed = {}
for document in format_embeddings_for_es_indexing(embd_data, titles_, _INDEX_):
res = client.index(
**document,
refresh = True
)
if res['_shards']['failed'] > 0:
failed[document["body"]["article_id"]] = res['_shards']
# document body for open search index
{
'index': 'test_v1',
'id': '208387',
'body': {
'article_id': '208387',
'title': 'Battery and Performance',
'title_vector': [ 1.77665558e-02, 1.95874255e-02,.....],
......
}
}
请帮帮忙
1条答案
按热度按时间6ioyuze21#
这可能与此处记录的内容有关:https://docs.aws.amazon.com/opensearch-service/latest/developerguide/ac.html#ac-advanced
请确保高级群集设置中的
rest.action.multi.allow_explicit_index
值为真