First create an index named "person" by sending PUT request to https://127.0.0.1:9200/person/_mapping, and the response body is
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "person"
}
After that I create a mapping by sending PUT request to https://127.0.0.1:9200/person/_mapping with the request body:
{
"properties": {
"name": {
"type": "text",
"index": true
},
"sex": {
"type": "keyword",
"index": true
},
"tel": {
"type": "keyword",
"index": false
}
}
}
the response body is
{
"acknowledged": true
}
I added a document with the following information
{
"name": "小明",
"sex": "男",
"tel": "12345678910"
}
Then I used field "tel" to search the document: GET https://127.0.0.1:9200/person/_search
{
"query": {
"match": {
"tel": "1"
}
}
}
the response body is
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 0,
"relation": "eq"
},
"max_score": null,
"hits": []
}
}
But in lower version such as v7.8.0, such a request will return an error because it was not allowed to search by "tel" whose index is false