Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
官方Elasticsearch PHP模块启用TTL_Php_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Ttl - Fatal编程技术网 elasticsearch,ttl,Php,elasticsearch,Ttl" /> elasticsearch,ttl,Php,elasticsearch,Ttl" />

官方Elasticsearch PHP模块启用TTL

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

我知道如何在php中使用curl激活ttl功能,但我想知道OfficeElasticSearch php库()是否也支持此功能。我已经深入研究了Lib的代码,但无法理解它


谢谢你的帮助

我创建了自己的方法来在索引类型上启用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);