Suggestions for storing hierarchical structure

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Suggestions for storing hierarchical structure

sujoysett
Hi,

Looking for suggestions on a business case which is being currently addressed to.
Following is the sample of data we want to store in elasticsearch in hierarchical format. It is close to a hierarchical synonym tree.

cine,movies,Entertainment
film,movies,Entertainment



One option is to store the data in a single ES document, as follows :

{
    "taxonomyName": "Entertainment",
    "taxonomyMembers": [],
    "taxonomyHierarchy": [
        {
            "taxonomyName": "movies",
            "taxonomyMembers": [
                "cine",
                "film"
            ],
            "taxonomyHierarchy": []
        }
    ]
}

Another option is to keep each word into separate ES documents, as follows :

{
    "taxonomyName": "Entertainment",
    "taxonomyHierarchy": [
        {
            "taxonomyName": "movies",
            "taxonomyMember": "cine"
        }
    ]
}

and

{
    "taxonomyName": "Entertainment",
    "taxonomyHierarchy": [
        {
            "taxonomyName": "movies",
            "taxonomyMember": "film"
        }
    ]
}



We have dictionary of such words, count reaching up-to several thousands, having hierarchy level up to 5 so far.
We keep on adding/deleting words in bulk from this dictionary, we often change hierarchy of several words in bulk.

Which of the above seems to be the better structure to store such data? A single large json document containing all words?  Or many small json documents each with a single word and its hierarchy? Any suggestions?


Thanks,
-- Sujoy.

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Suggestions for storing hierarchical structure

Clinton Gormley-2

> Which of the above seems to be the better structure to store such
> data? A single large json document containing all words?  Or many
> small json documents each with a single word and its hierarchy? Any
> suggestions?

It depends.  how do you want to search the data?  That really determines
the best structure for it

clint



--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Suggestions for storing hierarchical structure

sujoysett
Hi,

The requirement is expected to change dynamically .... so hard to tell right now   :)
Till now, the objective is to achieve a dictionary proliferation mechanism, with following functions:

1) Display the data in a tree-view hierarchy.
2) Add/remove more elements at any hierarchy level.
3) Add/remove/edit levels in hierarchy.

Thanks,
-- Sujoy.

On Wednesday, March 13, 2013 6:01:04 PM UTC+5:30, Clinton Gormley wrote:

> Which of the above seems to be the better structure to store such
> data? A single large json document containing all words?  Or many
> small json documents each with a single word and its hierarchy? Any
> suggestions?

It depends.  how do you want to search the data?  That really determines
the best structure for it

clint



--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.