elasticsearch - Index main-object, sub-objects, and do a search on sub-objects (that return sib-objects) -
i've object (simplified here), each strain have many chromosomes, have many locus, have many features, have many products, ... here put 1 of each.
the structure in json is:
{ "name": "my strain", "public": false, "authorized_users": [1, 23, 51], "chromosomes": [ { "name": "c1", "locus": [ { "name": "locus1", "features": [ { "name": "feature1", "products": [ { "name": "product1" //... } ] } ] } ] } ] }
i want add object in elasticsearch, moment i've add objects separatly: locus, features , products. it's okay search (i want type keyword, watch in name of locus, name of features, , name of products), need duplicate data public , authorized_users, in each subobject.
can register whole object in elasticsearch , search on each locus level, features , products ? , individually ? (no return strain object)
yes can search @ level (ie, query "chromosomes.locus.name").
but have arrays @ each level, have use nested objects (and nested query) want, bit more complex:
- https://www.elastic.co/guide/en/elasticsearch/reference/current/nested.html
- https://www.elastic.co/guide/en/elasticsearch/reference/5.3/query-dsl-nested-query.html
for last question, no, cannot subobjects individually, elastic returns whole json source object. if want data subobjects, have use nested aggregations.
Comments
Post a Comment