Partial search of attributes(Substring, Case insensitive and special chars included)

We are using ElasticSearch version 7.2 in our project with following characteristics:

  1. The main index mapping contains attributes, embedded objects as well as few nested (array) types.
  2. Analyzer : Standard analyzer

The requirement is to be able to perform partial search such that it supports

  1. Case insensitive
    e.g. “name”: “John Doe” should match a search query like “name”: “john doe”

  2. Patterns based like
    e.g. “name”: “John Doe” should match a search query like “name”: “ohn D

  3. Special characters(atleast the ones on standard English keyboard)
    e.g. “name”: “John (star) Doe” should match a search query like “name”: “john (star

We have tried using the

  1. match
  2. wildcard
  3. match_phrase_prefix
  4. and query_string
    but none of the above satisfies all the above 3 requirements together.

Is there any specific query DSL that can fulfill our requirements ?

Hey,

you should take some time to read about analysis and mapping. ngrams might be interesting to you for partial matches. Only when the data is indexed in the right way, your queries have the possibility to work as intended.

Even though it is a bit old already, The Definitive Guide's "Search in Depth" chapter is a great resource on such topics.

--Alex

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