OpenSearch query with type "term" not returning the same results in Amazon Neptune

0

I am using Amazon OpenSearch service version 1.3 alongside Amazon Neptune.

I followed Neptune docs for integrating full-text search capabilities in Neptune.

I needed to use a custom analyzer for one of the predicates found in Neptune, so instead of letting the stream poller lambda function create the index called amazon_neptune, I created the index manually from Opensearch dashboards.

The analyzer is only used on predicates.url.value and it uses path_hierarchy tokenizer.

What I want to achieve with this analyzer is that, when searching for a URL like domain.com/path, the query returns all URLs that are included in the hierarchy.

E.g: domain.com/path/blog, domain.com/path/blog/1, domain.com/path/about

The following query in OpenSearch returns exactly what I described in the above example

GET amazon_neptune/_search
{
  "query": {
    "term": {
      "predicates.url.value": "domain.com/path"
    }
  }
}

But, when making a query to Amazon Neptune like below, the resultset is empty:

%%gremlin

g.withSideEffect("Neptune#fts.endpoint", "opensearch-endpoint")
.withSideEffect('Neptune#fts.queryType', 'term')
.V().has("url", "Neptune#fts domain.com/path")

This is the amazon_neptune index used:

{
  "amazon_neptune" : {
    "aliases" : { },
    "mappings" : {
      "properties" : {
        "document_type" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "entity_id" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "entity_type" : {
          "type" : "text",
          "fields" : {
            "keyword" : {
              "type" : "keyword",
              "ignore_above" : 256
            }
          }
        },
        "predicates" : {
          "properties" : {
            "name" : {
              "properties" : {
                "value" : {
                  "type" : "text",
                  "fields" : {
                    "keyword" : {
                      "type" : "keyword",
                      "ignore_above" : 256
                    }
                  }
                }
              }
            },
            "url" : {
              "properties" : {
                "value" : {
                  "type" : "text",
                  "analyzer" : "path_analyzer"
                }
              }
            }
          }
        }
      }
    },
    "settings" : {
      "index" : {
        "number_of_shards" : "1",
        "provided_name" : "amazon_neptune",
        "max_result_window" : "20000",
        "analysis" : {
          "analyzer" : {
            "path_analyzer" : {
              "tokenizer" : "path_hierarchy"
            }
          }
        },
        "number_of_replicas" : "1",
      }
    }
  }
}
asked a year ago153 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions