Index on EMBEDDEDMAP

I am using the following Vertex in my schema:

{ 
"id" : "whatever", 
"tags" : { 
      "color": "green"
   }
}

whereby “tags” is from type EMBEDDEDMAP.

I created a NOTUNIQUE_HASH_INDEX on the keys of tags, which should be possible if I understood the docs correctly:

prop-names comma-separated list of properties that this automatic index is created for. Property with such name must already exist in schema. If property belongs to one of the Map types (LINKMAP, EMBEDDEDMAP) you can specify will be keys or values used for index generation. Use “by key” or “by value” expressions for that, if nothing will be specified keys will be used during index creation.

But when trying to query some vertices, the index does not seem to be used:

SELECT FROM TARGET WHERE tags.keys() IN ["color"]

+ FETCH FROM CLASS TARGET
+ FETCH FROM CLUSTER 33 ASC
+ FETCH FROM CLUSTER 34 ASC
+ FETCH FROM CLUSTER 35 ASC
+ FETCH FROM CLUSTER 36 ASC
+ FETCH FROM CLUSTER 37 ASC
+ FETCH FROM CLUSTER 38 ASC
+ FETCH NEW RECORDS FROM CURRENT TRANSACTION SCOPE (if any)
+ FILTER ITEMS WHERE 
  tags.keys() IN ["color"]

How should I query the field, so that its index is being used? What I am trying to achieve is to get all records where all keys of “tags” are contained in the list [“color”,…].

I am using orientdb 3.0.3.

Nö ideas? Is this maybe a Feature Request for github?

Hi @jonsalvas

did you try ?

SELECT FROM TARGET WHERE tags CONTAINSKEY "color"

Let me know if this helps

Thanks

yeah that works but

SELECT FROM TARGET WHERE tags CONTAINSKEY ["color", "type", ...] 

will only give me all TARGETS where at least one key of the list is contained, but I want to check if ALL of them are contained.

any updates on this? What I am trying to achieve is to match an embedded object which contains at least a subset of given keys. E.g. the given target:

{
  "@class": "TARGET",
  "tags": {
      "color": "green",
      "status": "new"
  }
}

filter

{
    "color": "green"
}

should not match (because of the missing status tag)

but filter

{
   "color": "green",
   "status": "new",
   "anyothertag": "anyothervalue"
}

should match because the target contains a subset of the tags.

In best case this should somehow work with an index to allow a fast searcg. Is this possible with orientdb?