【问题标题】:ElasticSearch, use of Wildcard on index names while using bulk apiElasticSearch,在使用批量 api 时在索引名称上使用通配符
【发布时间】:2015-03-17 07:43:09
【问题描述】:

我正在使用 RabbitMQ River Plugin for Elasticsearch 向我们的 ElasticSearch 索引插入/删除数据。 River 插件仅支持 Bulk API。 我们当前的数据使用多个索引,按日期索引,例如“indexName_yyyymmdd”

删除给定 ID 时,我们不知道该 ID 可以定位到哪个索引。我们认为我们将能够使用通配符格式,例如“indexName*”,就像在搜索中一样。

我们尝试了不同的组合,但看起来要么我们没有使用正确的语法,要么通配符绝对不受支持???

Examples we have tried:
// using default index in the url …
POST /mybestfares_gb*/bestfares_data/_bulk
{ "delete": {"_id": " AUry2F0Mu2oVvm5kYHaK " }}

// index in the meta section … 
POST /_bulk
{ "delete": {"_index":"mybestfares_gb*", "_type":"bestfares_data","_id": "AUry2F0Mu2oVvm5kYHaP" }}

在这两种情况下,我们都会收到以下错误: "error": "InvalidIndexNameException[[mybestfares_gb*] Invalid index name [mybestfares_gb*], must not contain the following characters [\\, /, *, ?, \", <, >, |, , ,]]"

在 ElasticSeach 文档中提到了这一点: “文档 API 和单索引别名 API 等单索引 API 不支持多索引。”

并且 Bulk API 被归类为多文档 API,所以我跳跃只是我没有使用正确语法的问题吗?

【问题讨论】:

    标签: elasticsearch elasticsearch-bulk-api


    【解决方案1】:

    很遗憾,这行不通。如果您仔细阅读文档:

    单索引 API,例如文档 API 和单索引别名 API 不支持多个索引。

    然后点击文档 API 列表的链接:

    文档 API

    本节介绍以下 CRUD API:

    单文档 API

    • 索引 API
    • 获取 API
    • 删除 API
    • 更新 API

    多文档 API

    • 多获取 API
    • 批量 API
    • 批量 UDP API
    • 通过查询 API 删除

    您会看到 Bulk API 和 Delete 和 Delete By Query API 都被归类为 Document API,它们不能使用通配符来覆盖多个索引:

    所有 CRUD API 都是单索引 API。 index 参数接受一个 单个索引名称,或指向单个索引的别名。

    http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/docs.html

    【讨论】:

    • 非常感谢约翰回复我。当我看到 Bulk API 被归类为多文档 API 时,我停止阅读该帮助页面,我错过了重要的最后一句话,对此感到抱歉。
    • 即使在最新的稳定版本中也不允许请求 CRUD API。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-24
    • 1970-01-01
    相关资源
    最近更新 更多