Edge Ngram not working on querying all fields

Hi,

I'm trying to implement search-as-you-type

PUT my_index
{
  "settings": {
    "analysis": {
      "analyzer": {
        "autocomplete": {
          "tokenizer": "autocomplete",
          "filter": [
            "lowercase"
          ]
        },
        "autocomplete_search": {
          "tokenizer": "lowercase"
        }
      },
      "tokenizer": {
        "autocomplete": {
          "type": "edge_ngram",
          "min_gram": 2,
          "max_gram": 10,
          "token_chars": [
            "letter"
          ]
        }
      }
    }
  },
  "mappings": {
    "doc": {
      "properties": {
        "firstname": {
          "type": "text",
          "analyzer": "autocomplete",
          "search_analyzer": "autocomplete_search"
        }
      }
    }
  }
}

my_index has other fields as well.

Now when I try to query:

GET patientdb/_search
{
  "query": {
    "match": {
      "_all": "charl"
    }
  }
}

It will give me no output.
But when I query just the firstname

GET patientdb/_search
{
  "query": {
    "match": {
      "firstname": "charl"
    }
  }
}

It gives me "Charles"

What should I do?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.