elasticsearch 使用AWS大容量索引给出“非法参数异常”、“不允许显式大容量索引”)

wb1gzix0  于 2023-02-21  发布在  ElasticSearch
关注(0)|答案(1)|浏览(170)

当我尝试使用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,.....],
    ......
    }
}

请帮帮忙

6ioyuze2

6ioyuze21#

这可能与此处记录的内容有关:https://docs.aws.amazon.com/opensearch-service/latest/developerguide/ac.html#ac-advanced
请确保高级群集设置中的rest.action.multi.allow_explicit_index值为真

相关问题