Substring matching

By now, you would have noticed that only exact word matches are taken as result qualifiers. What if I want an incomplete token or word to be matched?

For example, when I search for titani, it should match against titanium because titani is an incomplete form of titanium.

For this kind of purpose, it would be best to use the EdgeNGram-based analyzer.

First let's create the analyzer:

curl -X PUT "http://localhost:9200/my-index" -d '{
  "index": {
    "number_of_shards": 1,
    "number_of_replicas": 1
  },
  "analysis": {
    "filter": {
      "ngram": {
        "type": "edgeNgram",
        "min_gram": 1,
  "max_gram" : 50
      }
    },
    "analyzer": {
      "NGramAnalyzer": {
        "type": "custom",
        "tokenizer" : "standard", 
        "filter": "ngram"
      }
    }
  } 
}'  

Here, we are creating an edge NGram filter, ...

Get Elasticsearch Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.