一、索引数据的方式
- 直接使用cURL和REST API,发送json文档给ES进行索引,将会返回JSON应答
- 案例
-
curl -H "Content-Type: application/json" -XPUT '192.168.160.128:9200/testindex/testtype/1?pretty' -d '{"name":"zhangsan","age":"25"}'
其中:
-
若不添加-H,则会报错
-
{
"error" : "Content-Type header [application/x-www-form-urlencoded] is not supported",
"status" : 406
}
-
并且索引名称和类型名称不能大写,否则会报错
-
{
"error" : {
"root_cause" : [
{
"type" : "invalid_index_name_exception",
"reason" : "Invalid index name [testIndex], must be lowercase",
"index_uuid" : "_na_",
"index" : "testI
-