Set index
Set up mapping
Set the mappings information of the current index library
{
"mappings":{
"govBaseLog":{
"properties":{
"id":{
"type":"long",
"store":true
},
"title":{
"type":"text",
"store":true,
"index":true,
"analyzer":"standard"
},
"content":{
"type":"text",
"store":true,
"index":true,
"analyzer":"standard"
}
}
}
}
}
govBaseLog type name, definition of table name
properties attribute, definition of table fields
id field name type type long long integer store true store index not_analyzed not indexed, the default is not indexed, set to analyze is the index
It is equivalent to the definition of whether all the fields under a table are stored or not, index or analyzer
Set the mapping information after creating the index
json body
{
"helloWorld":{
"properties":{
"id":{
"type":"long",
"store":true
},
"title":{
"type":"text",
"store":true,
"index":true,
"analyzer":"standard"
},
"content":{
"type":"text",
"store":true,
"index":true,
"analyzer":"standard"
}
}
}
}
No need to add mappings, index name followed by /type name followed by /_mappings
Delete index library
Send request in delete mode + index library name
Create document document
1. Create an index
2. Add documents