- Elasticsearch 7.0 Cookbook(Fourth Edition)
- Alberto Paro
- 79字
- 2021-06-24 14:52:01
How to do it...
- Every field is automatically managed as an array. For example, to store tags for a document, the mapping will be as follows:
{
"properties" : {
"name" : {"type" : "keyword"},
"tag" : {"type" : "keyword", "store" : "yes"},
...
}
}
- This mapping is valid for indexing both documents. The following is the code for document1:
{"name": "document1", "tag": "awesome"}
- The following is the code for document2:
{"name": "document2", "tag": ["cool", "awesome", "amazing"] }