官方Elasticsearch PHP模块启用TTL
我知道如何在php中使用curl激活ttl功能,但我想知道OfficeElasticSearch php库()是否也支持此功能。我已经深入研究了Lib的代码,但无法理解它官方Elasticsearch PHP模块启用TTL,php,
elasticsearch,ttl,Php,
elasticsearch,Ttl,我知道如何在php中使用curl激活ttl功能,但我想知道OfficeElasticSearch php库()是否也支持此功能。我已经深入研究了Lib的代码,但无法理解它 谢谢你的帮助 我创建了自己的方法来在索引类型上启用ttl功能。我还就官方Github回购协议提交了一份文件: 嗯,我想您需要使用putMapping()方法更新elasticsearch映射。不需要特殊的方法调用 下面是一个在我们的系统中工作的示例 $params['index'] = 'yourindexname';
谢谢你的帮助 我创建了自己的方法来在索引类型上启用ttl功能。我还就官方Github回购协议提交了一份文件:
嗯,我想您需要使用putMapping()方法更新elasticsearch映射。不需要特殊的方法调用 下面是一个在我们的系统中工作的示例
$params['index'] = 'yourindexname';
$params['type'] = 'yourtypename';
$mapping = [
'_ttl' => [
'enabled' => 'true',
'default' => '14d',
],
'properties' => [
[... add your properties here ...]
]
];
$params['body']['yourtypename'] = $mapping;
$this->getClient()->indices()->putMapping($params);
您是否尝试过在
$params
数组中提交TTL?看看这个是的,我做了。。。但我需要激活索引中的ttl功能。
$params['index'] = 'yourindexname';
$params['type'] = 'yourtypename';
$mapping = [
'_ttl' => [
'enabled' => 'true',
'default' => '14d',
],
'properties' => [
[... add your properties here ...]
]
];
$params['body']['yourtypename'] = $mapping;
$this->getClient()->indices()->putMapping($params);