1
我有弹性集群在我的索引包含当前日期 - 如:跨多个指标Elasticsearch搜索 - 忽略不存在的索引
example-idex-2016-07-26 --> exists
example-idex-2016-07-25 --> exists
example-idex-2016-07-24 --> doesn't exist (weekend)
...
是否有可能跨多个索引查询,而忽略那些不存在。例如,这WORKS:
return elastic.search({
index: [
"example-idex-2016-07-26",
"example-idex-2016-07-25"],
],
...
});
鉴于此抛出回404:
return elastic.search({
index: [
"example-idex-2016-07-25",
"example-idex-2016-07-24"], //this doesn't exist
],
...
});
我希望第二个例子仅从25日返回文档。
如果我上周要**,这种情况不适用 - 例如18日至24日,只有那些存在的。 –
你可以有多个别名,'last-month','last-week'等,并查询你想要的。 – Val
如果您确实想要,您还可以在查询中指定['ignoreUnavailable:true'](https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-index.html)。 – Val