Query "bool must match" not returning any value whereas "bool must match_all" returns

My Elasticsearch was working perfectly fine before. I had to delete my elastics search for a few months on my server then I installed a new version two weeks back. I created the same index with the same mapping and added documents, which all worked fine. But my search is no more working. Please help me as I am stuck on this since last week.

Here is my mapping file

{
    "settings": {
        "number_of_shards": 1,
        "number_of_replicas": 0,
        "max_ngram_diff": "18",
        "analysis": {
            "analyzer": {
                "ngram_product_analyzer": {
                    "type": "custom",
                    "char_filter": [
                        "html_strip",
                        "&_to_and"
                    ],
                    "tokenizer": "ngram_product_token",
                    "filter": [
                        "lowercase",
                        "my_stopwords"
                    ]
                },
                "std_english_analyzer": {
                    "type": "standard",
                    "stopwords": "_english_"
                },
                "whitespace_search_analyzer": {
                    "type": "custom",
                    "tokenizer": "whitespace",
                    "filter": [
                        "lowercase",
                        "asciifolding",
                        "my_stopwords"
                    ],
                    "char_filter": [
                        "html_strip",
                        "&_to_and"
                    ]
                },
                "rp_search_analyzer": {
                    "tokenizer": "keyword",
                    "filter": ["lowercase"]
                }
            },
            "char_filter": {
                "&_to_and": {
                    "type": "mapping",
                    "mappings": [
                        "&=> and ",
                        "`=>  ",
                        "!=>  ",
                        "'=>  ",
                        "/=> divide ",
                        "_=>  ",
                        "-=>  ",
                        "\"=>  ",
                        "^=>  ",
                        "+=> and "
                    ]
                }
            },
            "filter": {
                "my_stopwords": {
                    "type": "stop",
                    "stopwords": ["_english_"]
                }
            },
            "tokenizer": {
                "ngram_product_token": {
                    "type": "ngram",
                    "min_gram": 3,
                    "max_gram": 20,
                    "token_chars": [
                        "letter",
                        "digit",
                        "punctuation",
                        "symbol",
                        "custom"
                    ],
                    "custom_token_chars": ":+-_/%*?()[]"
                }
            }
        }
    },
    "mappings": {
        "properties": {
            "objId": {"enabled": false},
            "title": {
                "type": "text",
                "analyzer": "ngram_product_analyzer"
              
            },
            "snippet": {
                "type": "text",
                "analyzer": "ngram_product_analyzer"
            },
            "businessCategory": {
                "type": "text",
                "analyzer": "ngram_product_analyzer"
            },
            "pageMap": {
                "properties": {
                    "cse_thumbnail": {
                        "type": "nested",
                        "properties": {
                            "src": {"enabled": false}
                        }
                    },
                    "list_images": {
                        "type": "nested",
                        "properties": {
                            "src": {
                                "type": "text",
                                "analyzer": "ngram_product_analyzer",
                                "search_analyzer": "whitespace_search_analyzer"
                            },
                            "imageDesc": {
                                "type": "text",
                                "analyzer": "ngram_product_analyzer",
                                "search_analyzer": "whitespace_search_analyzer"
                            },
                            "priceToShow": {
                                "type": "scaled_float",
                                "scaling_factor": 100
                            }
                        }
                    },
                    "fb_url": {
                        "type": "nested",
                        "properties": {
                            "src": {
                                "type": "text",
                                "analyzer": "ngram_product_analyzer",
                                "search_analyzer": "whitespace_search_analyzer"
                            }
                        }
                    },
                    "insta_url": {
                        "type": "nested",
                        "properties": {
                            "src": {
                                "type": "text",
                                "analyzer": "ngram_product_analyzer",
                                "search_analyzer": "whitespace_search_analyzer"
                            }
                        }
                    },
                    "youtube_url": {
                        "type": "nested",
                        "properties": {
                            "src": {
                                "type": "text",
                                "analyzer": "ngram_product_analyzer",
                                "search_analyzer": "whitespace_search_analyzer"
                            }
                        }
                    },
                    "website_url": {
                        "type": "nested",
                        "properties": {
                            "src": {
                                "type": "text",
                                "analyzer": "ngram_product_analyzer",
                                "search_analyzer": "whitespace_search_analyzer"
                            }
                        }
                    }
                }
            },
            "location": {"type": "geo_point"}
        }
    }
}

My Sample doc

{
    "doc": {
        "kind": "mySearchApp",
        "objId": {
            "objectId": "1"
        },
        "title": "Inflatables kids playsess",
        "snippet": "Inflatables are fun and filled with air to make it soft for your kids - best for birthday parties and best for any occasion when u want ur kids to have the most fun",
        "businessCategory": "event facilitator; event management; event organizer; meeting planner; event coordinator; event moderator; event-related; events; events; party; function; birthday; wedding planner; occasion; funeral planner; happy occasion; celebration' ",
        "address": "Buckminster Drive Building# 451 MA USA",
        "pageMap": {
            "cse_thumbnail": [
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/16312345d737c176a126caa04bdb4441_Image.jpeg"
                }
            ],
            "list_images": [
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/16312345d737c176a126caa04bdb4441_Image.jpeg",
                    "priceToShow": 150,
                    "imageDesc": "one slide and full combo",
                    "specialtyIndex": 0
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/84335a25cf93c6ce389e27ba15e65333_Image.jpeg",
                    "priceToShow": null,
                    "imageDesc": "",
                    "specialtyIndex": 0
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/013ef49e472bdae02ab22ebc77127596_Image.jpeg",
                    "priceToShow": null,
                    "imageDesc": "",
                    "specialtyIndex": 0
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/d3fd30cd277e1a8a2e1b8296c6c52e87_Image.jpeg",
                    "priceToShow": 45,
                    "imageDesc": "Red and blue",
                    "specialtyIndex": 1
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/21d9010fce77ce3e44919c5624d62672_Image.jpeg",
                    "priceToShow": 14,
                    "imageDesc": "tulips",
                    "specialtyIndex": 1
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/c034204f9eacd98912fc88c07b9999af_Image.jpeg",
                    "priceToShow": 1,
                    "imageDesc": "parrot",
                    "specialtyIndex": 1
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/d8672f4937abd746990f3a9d0db6e2f6_Image.jpeg",
                    "priceToShow": 12,
                    "imageDesc": "purple flower",
                    "specialtyIndex": 1
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/8e148c7c731c5f36e3af095fc8bfff99_Image.jpeg",
                    "priceToShow": 23,
                    "imageDesc": "yellow tullips",
                    "specialtyIndex": 2
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/5a5fc04b7670305fe731e175f294ba5e_Image.jpeg",
                    "priceToShow": 145,
                    "imageDesc": "Blue inflatable",
                    "specialtyIndex": 2
                }
            ],
            "fb_url": [
                {
                    "src": " "
                }
            ],
            "insta_url": [
                {
                    "src": ""
                }
            ],
            "youtube_url": [
                {
                    "src": "https://mail.google.com/"
                }
            ],
            "website_url": [
                {
                    "src": "http://inflate.com"
                }
            ]
        },
        "location": {
            "lat": 42.1730535,
            "lon": -71.222824
        }
    }
}

And here is my query

{
    "query": {
        "bool": {
            "must": [

                {
                    "match": {
                        "title": {
                            "query": "kids",
                            "fuzziness": 1
                        }
                    }
                }
            ]
        }
    }
}

your sample doc is with mapping.

Sorry, it was copy-paste error, I corrected it now

You must add docs without "doc" node, like this:

{
        "kind": "mySearchApp",
        "objId": {
            "objectId": "1"
        },
        "title": "Inflatables kids playsess",
        "snippet": "Inflatables are fun and filled with air to make it soft for your kids - best for birthday parties and best for any occasion when u want ur kids to have the most fun",
        "businessCategory": "event facilitator; event management; event organizer; meeting planner; event coordinator; event moderator; event-related; events; events; party; function; birthday; wedding planner; occasion; funeral planner; happy occasion; celebration' ",
        "address": "Buckminster Drive Building# 451 MA USA",
        "pageMap": {
            "cse_thumbnail": [
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/16312345d737c176a126caa04bdb4441_Image.jpeg"
                }
            ],
            "list_images": [
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/16312345d737c176a126caa04bdb4441_Image.jpeg",
                    "priceToShow": 150,
                    "imageDesc": "one slide and full combo",
                    "specialtyIndex": 0
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/84335a25cf93c6ce389e27ba15e65333_Image.jpeg",
                    "priceToShow": null,
                    "imageDesc": "",
                    "specialtyIndex": 0
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/013ef49e472bdae02ab22ebc77127596_Image.jpeg",
                    "priceToShow": null,
                    "imageDesc": "",
                    "specialtyIndex": 0
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/d3fd30cd277e1a8a2e1b8296c6c52e87_Image.jpeg",
                    "priceToShow": 45,
                    "imageDesc": "Red and blue",
                    "specialtyIndex": 1
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/21d9010fce77ce3e44919c5624d62672_Image.jpeg",
                    "priceToShow": 14,
                    "imageDesc": "tulips",
                    "specialtyIndex": 1
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/c034204f9eacd98912fc88c07b9999af_Image.jpeg",
                    "priceToShow": 1,
                    "imageDesc": "parrot",
                    "specialtyIndex": 1
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/d8672f4937abd746990f3a9d0db6e2f6_Image.jpeg",
                    "priceToShow": 12,
                    "imageDesc": "purple flower",
                    "specialtyIndex": 1
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/8e148c7c731c5f36e3af095fc8bfff99_Image.jpeg",
                    "priceToShow": 23,
                    "imageDesc": "yellow tullips",
                    "specialtyIndex": 2
                },
                {
                    "src": "https://parsefiles.back4app.com/QoUxFBYv7fEcUn8BsrLddggywVQ6UPb4H91HXoex/5a5fc04b7670305fe731e175f294ba5e_Image.jpeg",
                    "priceToShow": 145,
                    "imageDesc": "Blue inflatable",
                    "specialtyIndex": 2
                }
            ],
            "fb_url": [
                {
                    "src": " "
                }
            ],
            "insta_url": [
                {
                    "src": ""
                }
            ],
            "youtube_url": [
                {
                    "src": "https://mail.google.com/"
                }
            ],
            "website_url": [
                {
                    "src": "http://inflate.com"
                }
            ]
        },
        "location": {
            "lat": 42.1730535,
            "lon": -71.222824
        }    
}

I simulated and it worked.

Oh wow, it works like charm, thank you very very much for this help. I had been troubleshooting it for a week now.
Thanks a million.

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