I can't decide which way to save an increasing number of event information to elasticsearch. Each filterable fields have a limited number of options, but multiple options are allowed. Should I store the information directly like this:
{
"id":"1",
"name":"Event A",
"type":"Training,Workshop,Meeting",
"industrialSector":"Energy,Transport",
"country":"China"
// + 80 fields alike
}
Or use some backend work to turn the string values into numeric tokens before saving to elasticsearch:
{
"id":"1",
"name":"Event A",
"type":"1 3 5",
"industrialSector":"2 3",
"country":"7"
// + 80 fields alike
}
There will be a map object to reference the field options before saved or after fetched:
let options =
{
type:{
Training:1,
Fair:2
Workshop:3,
Brokerage:4
Meeting:5
},
industrialSector:{
Tech:1
Energy:2
Transport:3
}
}
The first one requires less work, but does it perform slower and require more diskspaces than the second one?