1创建索引 类似于mysql的表:PUT test {
"mappings": {
"properties": {
"name": {
"type": "text"
}
}
}
}
2:获取当前索引的结构:get test/_mapping
3:新增数据(同时也是编辑数据): 该方式会覆盖整条数据 也就是其余字段也会受影响
PUT test/_doc/1
{
"name":"zsl"
}
编辑数据不想覆盖采用该方式
POST test/_update/1
{
"doc": {
"name":"zslUpate"(仅更新name)
}
}
4: 创建数据自动生成id:
post test/_doc
{
"name":"zslPost"
}
5 :新增字段 并创建合并字段
PUT test/_mapping
{
"properties": {
"content1": {
"type": "text",
"copy_to": "content_union"
},
"content2": {
"type": "text",
"copy_to": "content_union"
},
"content_union": {
"type": "text",
"store": true
}
}
}
copy_to 熟悉就是目标的属性
tips:查询的时候并不会直接展示合并字段 但是支持分词搜索
返回字段复制的隐藏字段: