Updating a nested object (or other solutions ?)


(Aleks) #1

Hi there,

I'm working for an e-commerce website and I want to visualize stocks
evolutions.
This stock should be visualizable by (group) different hierarchy level.

Here is the mapping I did to represent the sale (=operation) hierarchy :

{
"operations": {
"mappings": {
"operation": {
"properties": {
"Sites": {
"properties": {
"siteid": {
"type": "long"
},
"siteuniversid": {
"type": "long"
},
"univers": {
"properties": {
"id": {
"type": "long"
},
"level": {
"type": "long"
},
"name": {
"type": "string"
},
"productFamilies": {
"properties": {
"id": {
"type": "long"
},
"name": {
"type": "string"
},
"references": {
"type": "nested",
"properties": {
"name": {
"type": "string"
},
"referenceid": {
"type": "long"
},
"stockevol": {
"properties": {
"date": {
"type": "date",
"format": "yyyy-MM-dd
HH:mm:ss"
},
"initial": {
"type": "integer"
},
"real": {
"type": "integer"
},
"sold": {
"type": "integer"
}
}
}
}
}
}
},
"univers": {
"properties": {
"id": {
"type": "long"
},
"level": {
"type": "long"
},
"name": {
"type": "string"
},
"productFamilies": {
"properties": {
"id": {
"type": "long"
},
"name": {
"type": "string"
},
"references": {
"type": "nested",
"properties": {
"name": {
"type": "string"
},
"referenceid": {
"type": "long"
},
"stockevol": {
"properties": {
"date": {
"type": "date",
"format": "yyyy-MM-dd
HH:mm:ss"
},
"initial": {
"type": "integer"
},
"real": {
"type": "integer"
},
"sold": {
"type": "integer"
}
}
}
}
}
}
}
}
}
}
}
}
},
"code": {
"type": "string"
},
"query": {
"properties": {
"match_all": {
"type": "object"
}
}
}
}
}
}
}
}

As you can see, a product (reference) is grouped into product Family
witch is placed into a univers (that can contains others universes) and
this one is in a site (country).
When I get stocks informations, I do have only referenceid. I do not have
information about the sale or other things. The sale informations
(hierarchy) is already present with references (referenceid and name)
loaded but nothing in stockevol.
So, I'd like to be able to add elements into my stockevol but I don't
know how to do it.

I thought that, by setting references to nested type, I would be able to
update it directly from the http://myserver:9200/myindex/references but I
failed.

Any help would be appreciated :slight_smile:

Thank you.
Aleks

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/cffe9fd5-e091-437e-b0d8-fa850d87eb7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2