# Substring does not match with in a string

**URL:** https://discuss.elastic.co/t/substring-does-not-match-with-in-a-string/305470
**Category:** Elasticsearch
**Created:** [May 24, 2022, 8:16am UTC](https://discuss.elastic.co/t/substring-does-not-match-with-in-a-string/305470 "2022-05-24T08:16:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vinayrordev](https://avatars.discourse-cdn.com/v4/letter/v/58f4c7/32.png) [@vinayrordev](https://discuss.elastic.co/u/vinayrordev)
#### Post date: [May 24, 2022, 8:16am UTC](https://discuss.elastic.co/t/substring-does-not-match-with-in-a-string/305470/1 "2022-05-24T08:16:06Z")

</div>

I am working on search functionality using the Elasticsearch, I need to show result in dropdown if string or substring is match.  
right now query result be like  
if I type in input box `test`  
so result is

test-load-1  
test-load-2  
test-load-3  
test-load-4  
test-load-5  
test-load-6

but if I type `load`  
in that case I am getting no results

my ES query ls like below

```auto
{
    "aggregations": {
        "myagg": {
            "aggregations": {
                "mymaxscore": {
                    "max": {
                        "script": {
                            "source": "_score"
                        }
                    }
                }
            },
            "terms": {
                "field": "name",
                "order": [
                    {
                        "mymaxscore": "desc"
                    }
                ],
                "size": 100
            }
        }
    },
    "query": {
        "bool": {
            "filter": {
                "bool": {
                    "should": {
                        "terms": {
                            "exists": [
                                "true"
                            ]
                        }
                    }
                }
            },
            "must": {
                "match": {
                    "name.engram": {
                        "operator": "or",
                        "query": "load"
                    }
                }
            },
            "should": [
                {
                    "match": {
                        "name.engram": {
                            "operator": "and",
                            "query": "load"
                        }
                    }
                },
                {
                    "term": {
                        "name.lower": {
                            "boost": 100,
                            "value": "load"
                        }
                    }
                },
                {
                    "prefix": {
                        "name.lower": {
                            "boost": 100,
                            "value": "load"
                        }
                    }
                }
            ]
        }
    },
    "size": 100
}

```

---

<div class="post-metadata">

### Author: ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)
#### Post date: [May 24, 2022, 1:27pm UTC](https://discuss.elastic.co/t/substring-does-not-match-with-in-a-string/305470/2 "2022-05-24T13:27:28Z")

</div>

Hi!

Give a example your mapping.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 21, 2022, 1:28pm UTC](https://discuss.elastic.co/t/substring-does-not-match-with-in-a-string/305470/3 "2022-06-21T13:28:25Z")

</div>

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