Alexander Schranz
Alexander Schranz

Reputation: 2450

Elasticsearch Prefixfilter special character not working

I used ongr-elasticsearch bundle in php and wanted to add a PrefixFilter. When I add a slash at the front of the prefix it dont work. Here the query I build in ElasticSearch HQ Plugin:

{
  "query": {
    "filtered": {
      "filter": {
        "prefix": {
          "path": "/cmf"
        }
      }
    }
  }
}

EDIT:

FXIED: need to use an custom pathAnalyzer to use queries

Upvotes: 2

Views: 396

Answers (1)

Adam Elsodaney
Adam Elsodaney

Reputation: 7808

Escape the forward slash

"prefix": {
  "path": "\/cmf"
}

Upvotes: 1

Related Questions