Hi Mukta take a look at this
http://orientdb.com/docs/last/Indexes.html https://groups.google.com/forum/#!msg/orient-database/OlIJygtDcHw/-1KKDEAQ5qUJ I think it's what you are looking for. The first one is the official documentation page, there is also an example on how to create and query an index on embedded map. The second one is an old post where you can find some practical examples Luigi 2015-04-24 3:20 GMT+02:00 Mukta <[email protected]>: > Hi all, > > I am currently evaluating OrientDB for a project at work. I need to be > able to save and efficiently search JSON data that will of the form - > > { > "id":"myid", > "type":"mytype", > "metadata": { "key1":"val1", "key2":"val2", "key3":"val3"} > } > > The "metadata" field is basically an JSON object whose fields are not > known in advance. > I have created a class to hold records such as the one above - create > class MyClass extends V > > I want to be able to make queries such as - > > select from MyClass where metadata.key1="val1" > > I am not able to figure out how I would create indexes for such queries. > Without an index, the query takes about 6-7 seconds on a table of 1M > records! > > There are a couple of things I tried - > > 1) I created an EMBEDDEDMAP property for "metadata" and then created a > NOTUNIQUE index on it. But queries such as select from MyClass where > metadata.key1="val1" do not hit the index. > Queries of the form 'select from MyClass where metadata='key1:val1' do not > return any results. > > 2) I created another class for the 'metadata' field and declared an > EMBEDDED property for 'metadata' that links to this new class. Then if I > try to create an index on the property, I run into a NullPointerException. > > Could someone provide some help here? OrientDB seems to fit all my other > requirements perfectly and I don't want to rule it out for this one use > case. > > Thanks > Mukta > > > > > -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
