Partial matching not working in this query Partial matching not working in this query elasticsearch elasticsearch

Partial matching not working in this query


If the name field is using default analyzer then the asterisk wildcard characters are dropped during analysis phase. Hence you always get results where name is exactly sarchterm. You need to use a Wildcard query for matching any document where value of name field contains searchterm.

query: {    filtered: {        filter: {            bool: {                should: [                    {                        query: {                            wildcard: {                                "name": "*" + searchterm + "*"                             }                        }                    }                ]            }        }    }}