Phrase_prefix search issue with single character

I have a data like 'Dipanshu S', 'Mohit Sharma' and 'Mohit Shakya' in my database and when i do a ES search query like :-

"multi_match": {
"query": "Mohit S",
"type": "phrase_prefix",
"fields": [ "name", "nickname" ]
}

It gives me correct result 'Mohit Sharma' and 'Mohit Shakya' as it returns results with exact matching of first term 'Mohit' and returning all words starting with 'S' but when i do same search with query

"multi_match": {
"query": "Dipanshu S",
"type": "phrase_prefix",
"fields": [ "name", "nickname" ]
}

:"Dipanshu S" then it doesn't return any results because the word 'S' is not a word starting with character 'S' but its a complete word in itself in the data 'Dipanshu S'.

So how to manipulate query to get results with single character words?

can you please share a fully reproducible example including index creation, document indexing and mapping...

This example works for me, so something in your setup seems to be different

DELETE test

PUT test/_doc/1?refresh
{
  "name" : "Dipanshu S"
}

GET test/_search
{
  "query": {
    "multi_match": {
      "query": "Dipanshu S",
      "type": "phrase_prefix",
      "fields": [
        "name"
      ]
    }
  }
}

Thanks!

--Alex

I'm sharing my mappings and settings(analyzers) configs.
Mapping:

 "name": {
                        "type": "keyword",
                        "fields": {
                            "caseInsensitive": {
                                "type": "text",
                                "analyzer": "lowercase_keyword_analyzer"
                            },
                            "fulltext": {
                                "type": "text",
                                "analyzer": "english_standard_edgengram_analyzer",
                                "search_analyzer": "english_standard_analyzer"
                            }
                        },
                        "normalizer": "lowercase_normalizer"
                    }

Analyzer:

 "analyzer": {
                        "numeric_edgengram_analyzer": {
                            "filter": [
                                "edgengram_filter"
                            ],
                            "char_filter": [
                                "numeric_filter"
                            ],
                            "type": "custom",
                            "tokenizer": "keyword"
                        },
                        "lowercase_keyword_analyzer": {
                            "filter": [
                                "lowercase"
                            ],
                            "type": "custom",
                            "tokenizer": "keyword"
                        },
                        "numeric_keyword_analyzer": {
                            "type": "custom",
                            "char_filter": [
                                "numeric_filter"
                            ],
                            "tokenizer": "keyword"
                        },
                        "english_standard_analyzer": {
                            "filter": [
                                "lowercase"
                            ],
                            "type": "keyword"
                        },
                        "english_standard_edgengram_analyzer": {
                            "filter": [
                                "lowercase",
                                "edgengram_filter"
                            ],
                            "type": "custom",
                            "tokenizer": "english_standard_tokenizer"
                        }
                    }

And you can test with some different data like "Dipanshu S Gupta", "Dipanshu Sharma".

can you please share the full commands of index creation + mapping in the console tools or in a curl compatible fashion? The above snippets means, everyone reading your ask for support needs to convert this in working snippets, which again is quite tedious.

Thank you!

hey, it's little bit difficult for me to share that code but just wants to know that does the query "Dipanshu S" gives the result "Dipanshu S Sharma" ? I mean does the prefix "S" includes the result "Dipanshu S Sharma" as "S" is not a word starting from "S" but it's a complete word in itself. And did you got my question?