elasticsearch 创建索引

$url = "127.0.0.1:9200/tyep/";//es存储路径
 $json=array();
$json["mappings"]["log"]["properties"]["title"]["type"]="string";
$json["mappings"]["log"]["properties"]["title"]["index"]="not_analyzed";
$json["mappings"]["log"]["properties"]["content"]["type"]="string";
$json["mappings"]["log"]["properties"]["content"]["index"]="not_analyzed";//默认analyzed
$json["mappings"]["log"]["properties"]["subject"]["type"]="string";      
$json["mappings"]["log"]["properties"]["subject"]["index"]="not_analyzed";
$json["mappings"]["log"]["properties"]["url"]["type"]="string";
$json["mappings"]["log"]["properties"]["url"]["index"]="not_analyzed";
 echo json_encode($json);
 $r =$common->callInterfaceCommon($url, "PUT", json_encode($json));//批量存入数据

猜你喜欢

转载自blog.csdn.net/abc595951988/article/details/71430318