I'm relatively new to elasticsearch and I would like to map one of my field to an associative array structure.
What I currently Have :
One product of type product in the index products:
{
"name":"Nexus 10",
"category":"Tablets",
"interests": {
"1":30,
"3":70
}
}
As you can see, the field interests is an associative array. The key is a User ID and the value is the number of times the user talked about this product.
Dynamic mapping provided me with :
{
"products":{
"mappings":{
"product":{
"properties":{
"category":{
"type":"string"
},
"interests":{
"properties":{
"1":{
"type":"long"
},
"3":{
"type":"long"
},
}
},
"name":{
"type":"string"
}
}
}
}
}
}
What I want :
Since I'm going to have lots of entries in the interests field, I don't want the dynamic mapping to map each ID.
The idea is to be able to look for a specific user ID in the interests field so that I can boost the score of the result depending on the number of times this particular user talked about this product.
I would like to be able to map this kind of structure.
Do you have any idea how to achieve that?
Thanks,