Amazon Neptune full text search query not working as expected

442 views Asked by At

I am trying to implement a full-text search for Neptune DB using elasticsearch manually but getting this error :

{"requestId":"bcb16f6b-7e60-4e71-b0d8-a6a4a9b38b00","code":"MalformedQueryException","detailedMessage":"Failed to interpret Gremlin query: null"}

Here is my document:

{
    "entity_id": "f8b9726f-74f9-a0e0-5fbd-b609bbb14f89",
    "entity_type": [
        "suggestions"
    ],
    "document_type": "vertex",
    "predicates": {
        "title": {
            "value": "samsung mobile"
        }
    }
}

query:

g.withSideEffect('Neptune#fts.endpoint','elasticsearch cluster end point').withSideEffect('Neptune#fts.queryType', 'match').V().has('title','Neptune#fts samsung').local(values('title').fold()).limit(5).valueMap().toList()

it is giving error only if I am putting an existing word in search i.e Samsung but if I am searching for an unavailable word it worked fine not throwing any error. Not sure what is wrong here, can anyone help me with this?

1

There are 1 answers

0
Kelvin Lawrence On BEST ANSWER

The local step you showed will, for each 'title' property found, create a list with that property in it. Without the local step all values found would be wrapped into a single list if you just did values('title').fold() .

Note, however, and this is probably why your query was failing, that you cannot add a valueMap step after that local step as you would be trying to apply valueMap not to vertices but to one or more lists of strings coming out of the local step.