我们是否可以选择在Search :: Elasticsearch模块中添加标题。
use Search::Elasticsearch;
my $esloc='abc.com';
my $es = Search::Elasticsearch->new(nodes => [
"$esloc"],
timeout => 60,
no_refresh => 0,
userinfo => 'username:password'
);
答案 0 :(得分:1)
您应该可以这样做:
my $es = Search::Elasticsearch->new(nodes => [
"$esloc"],
timeout => 60,
no_refresh => 0,
userinfo => 'username:password',
default_headers => { 'Content-Type' => 'application/ndjson' }
);