gpt4 book ai didi

php - 在嵌套属性ElasticSearch中添加和删除对象

转载 作者:行者123 更新时间:2023-12-03 01:16:49 25 4
gpt4 key购买 nike

如何在ElasticSearch的嵌套属性中删除和添加项目?大多数例子都行不通。

最佳答案

删除项目的更简单方法(灵感来自my other answer here)。

没有for循环,没有ifs :-)

$this->getClient()->update(
[
'index' => $this->getIndexName(),
'id' => $Item->getReportId(),
'body' => [
'script' => [
'lang' => 'painless',
'inline' => 'ctx._source.reports.removeAll{ it -> it.entry_id == params.entry_id && it.source == params.source }',
'params' => ['entry_id' => (string)$Item->getEntryId(), 'source' => $Item->getTableName()],
],
],
]
);

关于php - 在嵌套属性ElasticSearch中添加和删除对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62211875/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com