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

标签 elasticsearch elasticsearch-bulk-api

我正在使用RabbitMQ River插件进行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被归类为Multi-Document API,所以我只是不使用正确的语法而已吗?

最佳答案

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

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



然后点击链接到Document 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 and 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

关于elasticsearch - ElasticSearch,在使用批量API时在索引名称上使用通配符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28022310/

相关文章:

elasticsearch - 使用 NEST 在 ElasticSearch 上批量更新

elasticsearch - 使用 golang 包 'elastic' 中的 BulkIndexRequest

amazon-web-services - AWS ElasticSearchService index_create_block_exception

java - 如何模拟 ElasticSearch 客户端

elasticsearch - 如何从ElasticSearch中的文件导入GEO_TYPE

elasticsearch - 我可以通过ElasticSearch Bulk Api中的查询进行更新吗?

java - 使用带 S3 的 AWS ElasticSearch 的角色问题

python - 在 Amazon Elasticsearch Service 上建立索引 - 批量插入

elasticsearch - elasticsearch批量脚本与elasticsearch.yml更改都不起作用