P.neq() predicate uses wrong ES mapping


Janusgraph setup:
Storage backend: Scylla 3
Indexing backend: Elasticsearch 6
JG version: 0.5.3

Steps to reproduce:

1) Create a vertex with two fields mapped in ES index as TEXTSTRING("x" and "y")
2) Insert a node with values: x="anyvalue", y="??"
3) Execute these queries:
  • g.V().has("x","anyvalue").has("y",P.neq("??"))
  • g.V().has("x","anyvalue").has("y",P.eq("??"))

Expected result:
  • First query returns an empty set
  • Second query returns one node

Actual result:
  • Both queries return the same result

Looks like the issue is in this line https://github.com/JanusGraph/janusgraph/blob/master/janusgraph-es/src/main/java/org/janusgraph/diskstorage/es/ElasticSearchIndex.java#L959
Code checks for Cmp.EQUAL but not for Cmp.NOT_EQUAL, so that in case of NOT_EQUAL tokenized field is used

Join janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.