版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
没有索引库,直接添加索引库和相关信息
url为:http://localhost:9200/blog1 put类型
{
"mappings":{
"article":{
"properties":{
"id":{
"type":"long",
"store":true
},
"title":{
"type":"text",
"store":true,
"index":true,
"analyzer":"standard"
},
"content":{
"type":"text",
"store":true,
"index":true,
"analyzer":"standard"
}
}
}
}
}
这样就创建了一个blog1的索引库,type为article
还可以先创建索引库后,再往里面添加信息
{
"hello":{
"properties":{
"id":{
"type":"long",
"store":true
},
"title":{
"type":"text",
"store":true,
"index":true,
"analyzer":"standard"
},
"content":{
"type":"text",
"store":true,
"index":true,
"analyzer":"standard"
}
}
}
}
url为 http://localhost:9200/blog/hello/_mappings Post类型
这样和上面的效果一样。