查询索引
GET _analyze{
{
"analyzer":"分词器" #指定分词器,es内置有多种analyzer
"text":"查询的文本"
}
创建索引
PUT /索引名称/文档类型/文档id
{
"name":"悟空",
"age":500
}
{
"_index" : "test1",
"_type" : "type1",
"_id" : "1",
"_version" : 14, 如果重复创建,则会覆盖,且每次版本号都会+1
"result" : "updated",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 13,
"_primary_term" : 1
}
修改文档
POST /索引名称/文档类型/文档id
{
"doc":{
"name":"孙悟空"
}
}
{
"_index" : "test1",
"_type" : "type1",
"_id" : "1",
"_version" : 5, //每次内容有变化时执行修改操作都会+1
"result" : "noop", //如果内容没有变化:noop ,否则updated
"_shards" : {
"total" : 0,
"successful" : 0,
"failed" : 0
},
"_seq_no" : 4,
"_primary_term" : 1
}
删除索引
DELELE 索引名称