Filter range not working


(Justin Luong) #1

My data has products with price >= 500000 and price <= 10000000. But result search is zero. I don't know. What is my problem? . Please help me.

This is my params.


Array
(
    [index] => nht-test
    [type] => products
    [from] => 0
    [size] => 24
    [body] => Array
        (
            [query] => Array
                (
                    [filtered] => Array
                        (
                            [query] => Array
                                (
                                    [match] => Array
                                        (
                                            [brand] => apple
                                        )

                                )

                            [filter] => Array
                                (
                                    [range] => Array
                                        (
                                            [price] => Array
                                                (
                                                    [gte] => 500000
                                                    [lte] => 10000000
                                                )

                                        )

                                )

                        )

                )

        )

)

And result:




Array
(
    [took] => 3
    [timed_out] => 
    [_shards] => Array
        (
            [total] => 5
            [successful] => 5
            [failed] => 0
        )

    [hits] => Array
        (
            [total] => 0
            [max_score] => 
            [hits] => Array
                (
                )

        )

)

(Christoph) #2

Does the match query alone return any document? You could also try to change that part to match_all and see if the filter works and then start narrowing down the problem.


(system) #3