Elasticsearch实战
准备数据
# 创建索引
PUT /forum?include_type_name=true
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"post":{
"properties":{
"title":{
"type":"text",
"analyzer":"english"
}
}
}
}
}
# 创建两个文档
PUT /forum/post/_bulk
{"index":{"_id":1}}
{"title":"learning too many courses"}
{"index":{"_id":2}}
{"title":"learned more courses"}