ElasticSearch,在使用批量 api 时在索引名称上使用通配符

ElasticSearch, use of Wildcard on index names while using bulk api

我正在使用适用于 Elasticsearch 的 RabbitMQ River 插件将 Insert/Delete 数据添加到我们的 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不支持多索引。”

而批量 API 被归类为多文档 API,所以我想知道是我没有使用正确的语法吗?

不幸的是,这行不通。如果您仔细阅读文档:

Single index APIs such as the Document APIs and the single-index alias APIs do not support multiple indices.

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

Document APIs

This section describes the following CRUD APIs:

Single document APIs

  • Index API
  • Get API
  • Delete API
  • Update API

Multi-document APIs

  • Multi Get API
  • Bulk API
  • Bulk UDP API
  • Delete By Query API

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

All CRUD APIs are single-index APIs. The index parameter accepts a single index name, or an alias which points to a single index.

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