设置好了模版和索引,并且生成。但是查看mapping时候发现enable一直为false:
{
"laravel" : {
"mappings" : {
"_default_" : {
"_all" : {
"enabled" : false
},
"dynamic_templates" : [
{
"strings" : {
"match_mapping_type" : "string",
"mapping" : {
"analyzer" : "ik_smart",
"fields" : {
"keyword" : {
"type" : "keyword"
}
},
"ignore_above" : 256,
"type" : "text"
}
}
}
]
}
}
}
}
问题出现的环境背景及自己尝试过哪些方法
$client = new Client();
// 创建模版
$url = config('scout.elasticsearch.hosts')[0] . '/_template/tmp';
$client->put($url, [
'json' => [
'template' => config('scout.elasticsearch.index'),
'settings' => [
'number_of_shards' => 1
],
'mappings' => [
'_default_' => [
'_all' => [
'enabled' => true
],
'dynamic_templates' => [
[
'strings' => [
'match_mapping_type' => 'string',
'mapping' => [
'type' => 'text',
'analyzer' => 'ik_smart',
'ignore_above' => 256,
'fields' => [
'keyword' => [
'type' => 'keyword'
]
]
]
]
]
]
]
]
]
]);
$this->info("========创建模板成功=======");
$url = config('scout.elasticsearch.hosts')[0] . '/' . config('scout.elasticsearch.index');
$client->put($url, [
'json' => [
'settings' => [
'refresh_interval' => '5s',
'number_of_shards' => 1,
'number_of_replicas' => 0,
],
'mappings' => [
'_default_' => [
'_all' => [
'enabled' => false
]
]
]
]
]);
$this->info("========创建索引成功=======");
google和百度过。都没找到方法
环境java11 elasticsearch5.0
有什么思路或解决办法吗?各位大神