elastic / elasticsearch-php

Official PHP client for Elasticsearch.
https://www.elastic.co/guide/en/elasticsearch/client/php-api/current/index.html
MIT License
5.26k stars 965 forks source link

Weird error, [terms] query does not support [minimum_should_match]] #321

Closed harpreetsb closed 8 years ago

harpreetsb commented 8 years ago

my parameters

Array
(
    [index] => lyfboat
    [type] => hospitals
    [size] => 10
    [from] => 0
    [body] => Array
        (
            [query] => Array
                (
                    [bool] => Array
                        (
                            [must] => Array
                                (
                                    [0] => Array
                                        (
                                            [nested] => Array
                                                (
                                                    [path] => treatments
                                                    [query] => Array
                                                        (
                                                            [bool] => Array
                                                                (
                                                                    [must] => Array
                                                                        (
                                                                            [term] => Array
                                                                                (
                                                                                    [treatments.treatment_slug] => cardiology
                                                                                )

                                                                        )

                                                                )

                                                        )

                                                )

                                        )

                                    [1] => Array
                                        (
                                            [terms] => Array
                                                (
                                                    [location.country] => Array
                                                        (
                                                            [0] => India
                                                        )

                                                )

                                        )

                                    [2] => Array
                                        (
                                            [terms] => Array
                                                (
                                                    [hospitals.facilities.facilities_slug] => Array
                                                        (
                                                            [0] => atm
                                                        )

                                                )

                                        )

                                )

                            [minimum_should_match] => 3
                        )

                )

            [_source] => Array
                (
                    [exclude] => Array
                        (
                            [0] => facilities.hospital_id
                            [1] => facilities.status
                            [2] => facilities.facilities_hospital_id
                            [3] => facilities.facilities_icon
                            [4] => treatments.hospital_id
                            [5] => treatments.status
                            [6] => treatments.treatment_status
                            [7] => doctors.hospital_id
                            [8] => location.latitude
                            [9] => location.longitude
                            [10] => location_status
                        )

                )

        )

)

Output of explain query

Array
(
    [valid] => 1
    [_shards] => Array
        (
            [total] => 1
            [successful] => 1
            [failed] => 0
        )

    [explanations] => Array
        (
            [0] => Array
                (
                    [index] => lyfboat
                    [valid] => 1
                    [explanation] => +(+ToParentBlockJoinQuery (+(+treatments.treatment_slug:cardiology) #QueryWrapperFilter(_type:__treatments)) +(location.country:India) +(hospitals.facilities.facilities_slug:atm)) #QueryWrapperFilter(+ConstantScore(_type:hospitals))
                )

        )

)

still getting in LOG [terms] query does not support [minimum_should_match]]

harpreetsb commented 8 years ago

My fault

issam-chouchane commented 8 years ago

Hi Harprretsb

How do you fix it ?

Regards.