Search code examples
gremlinamazon-neptunegremlinpython

Get score from AWS Neptune Search


I want to get the scores for each search result like you would be able to in elasticsearch. How do you do this through Neptune?

I'm using this gremlin query, but I'm not sure how you would get the score out of it.

limit = 100
g.withSideEffect(
    "Neptune#fts.endpoint", f"{url}"
)
.withSideEffect("Neptune#fts.queryType", "query_string")
.withSideEffect("Neptune#fts.maxResults", limit)
.withSideEffect("Neptune#enableResultCache", enable_cache)
.withSideEffect("Neptune#fts.sortOrder", "DESC"). # <- switching this doesn't flip the order
.V()
.hasLabel("table")
.has(
    "*",
    f"Neptune#fts entity_type:"table" AND ({query})",
)

Solution

  • Amazon Neptune's full-text search integration does not currently support returning the scores from a Gremlin query. To get these scores, you need to query ElasticSearch directly.