一.创建索引test1
url:http://localhost:9200/test1
方式:put
json:
{
"settings": {
"index": {
"number_of_shards": 5,
"number_of_replicas": 1
}
},
"mappings": {
"properties": {
"news_id": {
"type": "long"
},
"news_title": {
"type": "text"
},
"news_content": {
"type": "text"
}
}
}
}
二.向索引中添加数据
url:http://localhost:9200/test1/_doc/1
方式:put
json:
{
"news_id": 1,
"news_title": "测试1",
"news_content": "测试数据1"
}