Elastic Search批量需要添加标题

时间:2018-08-17 04:59:46

标签: perl elasticsearch

我们是否可以选择在Search :: Elasticsearch模块中添加标题。

    use Search::Elasticsearch; 

     my $esloc='abc.com';

     my $es = Search::Elasticsearch->new(nodes => [
            "$esloc"],
            timeout => 60,
            no_refresh   => 0,
            userinfo => 'username:password'
        );

1 个答案:

答案 0 :(得分:1)

您应该可以这样做:

 my $es = Search::Elasticsearch->new(nodes => [
        "$esloc"],
        timeout => 60,
        no_refresh   => 0,
        userinfo => 'username:password',
        default_headers => { 'Content-Type' => 'application/ndjson' }
    );