Newbie - How to filter by price range

Hello, need some help with a filter query.

This is my query:

GET /products/item/_search?q=jeans { 
    "from": "0", 
    "size": "160", 
    "aggs":{"shopId":{"terms":{"field":"shopId"}}},
    "suggest": {"product_sugg": {"text" : "jeans","term" : { "field": "description" }}},
    "filter" : 
    {
        "range" : {
                "price_price" : {
                    "gte": 0,
                    "lte": 20,
                    "boost" : 2.0
                }}}}

but the "price_price" filter does not work. I get the follwing product with price_price 119.95 as first result:

"_source": {
               ....
               "price_display": "119.95 EUR",
               "price_price": "119.95",
               "ship_price": "0.00",
               "ship_price_display": "0.00 EUR"
            }

What can I do?

Thank You and Best Regards
Daniel

Check your mappings. It looks like your price is indexed as a string, not a number.

Yes - you're exactly correct. After setting the mappings to float it works fine :slight_smile:
Thank You!

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