创建mapping
put http://47.102.113.172:9200/blog1
{
"mappings":{
"doc":{
"properties":{
"title":{
"type":"text"
},"time":{
"type":"date"
},"content":{
"type":"text"
“index”:fasle
}
}
}
}
}
blog1 : 相当于数据库名称
doc: 相当于数据库表名
title: 相当于数据库字段名
type: 相当于数据库的字段类型
index: false该字段不能被作为索引查询,默认为true
添加数据到表blog1
put http://47.102.113.172:9200/blog1/doc/1
{
"title":"华为发布鸿蒙操作系统",
"time":"2019-07-02",
"content":"为了应对美国的限制,华为将推出备胎鸿蒙操作系统"
}
time必须是时间的格式
查询
http://47.102.113.172:9200/blog1/doc/_search?q=title:华为