1、查看当前已创建索引
GET /_cat/indices?v
可以查看到所有索引信息
2、删除索引
DELETE /elasticsearchnews?pretty
3、创建索引
PUT /testindex
{
"mappings":{
"properties":{
"content":{
"type":"text"
},
"updateTime":{
"type":"long"
}
}
}
}
这样只适合自己测试创建索引,创建一个primary shard和一个 replica shard
4、查询—匹配指定索引下的所有数据
GET elasticsearchnews/_search
{
"query": {
"match_all": {
}
}
}
5、查询—匹配指定索引的指定列
GET /elasticsearchquestion/_search
{
"query": {
"match": {
"content": "车"
}
}
}
6、根据字段排序
GET /elasticsearchquestion/_search
{
"query": {
"match": {
"content": "车"
}
},
"sort": { "updateTime": { "order": "desc" }}
}



