Hi Sergej,
The example string "??" you used was not an ordinary string. Apparently, somewhere in elasticsearch it is interpreted as a wildcard. See my transcript below with some other property value and the index behaves according to your and my expectations. I made some attempts to escape the question marks in your example string like "\\?, but was not successful. The janusgraph documentation is very quiet on the use of wildcards for indexing backends.
Best wishes, Marc
bin/janusgraph.sh start
bin/gremlin.sh
graph = JanusGraphFactory.open('conf/janusgraph-cql-es.properties')
mgmt = graph.openManagement()
index = mgmt.buildIndex("indexname", Vertex.class)
xproperty = mgmt.makePropertyKey("x").dataType(String.class).make();
yproperty = mgmt.makePropertyKey("y").dataType(String.class).make();
index.addKey(xproperty, Mapping.TEXTSTRING.asParameter())
index.addKey(yproperty, Mapping.TEXTSTRING.asParameter())
index.buildMixedIndex("search")
mgmt.commit()
ManagementSystem.awaitGraphIndexStatus(graph, 'indexname').status(SchemaStatus.REGISTERED, SchemaStatus.ENABLED).call()
==>GraphIndexStatusReport[success=true, indexName='indexname', targetStatus=[REGISTERED, ENABLED], notConverged={}, converged={x=ENABLED, y=ENABLED}, elapsed=PT0.017S]
g = graph.traversal()
g.addV('Some').property('x', 'x1').property('y', 'y1')
g.addV('Some').property('x', 'x2').property('y', '??')
g.tx().commit()
Expected behaviour:
g.V().has("x","x1").has("y",P.neq("y1"))
===>
g.V().has("x","x1").has("y",P.eq("y1"))
==>v[4224]
g.V().has("x","x1").has("y",P.neq("y4"))
==>v[4224]
Undocumented behaviour:
g.V().has("x","x2").has("y",P.neq("??"))
==>v[4264]
g.V().has("x","x2").has("y",P.eq("??"))
==>v[4264]
g.V().has("x","x2").has("y",P.neq("y4"))
==>v[4264]