Range based query on number type

My schema includes field "mileage" with a type set to "number".
When I run a query like the following, I get all documents, not just those in the range.

{ 
    "query":"", 
        "filters": { 
            "mileage": {
                "from": 0, 
                "to": 40000
            }
      }
}

Is there something I'm missing? I'm referencing the following documentation.

How I set up the index. I imported the documents first through the JSON API. I then set the field type for the mileage and some other fields from the app search UI. Do I need to re-import all my documents to get the field type to be indexed properly?

What you have looks correct. Are you using App Search at swiftype.com or the self-managed version? If self-managed, what version are you using?

@JasonStoltz Elastic App Search Version 7.6.1. This is Elastic App Search on elastic.co.

@JasonStoltz

Here's an example query and result set

    {
      "query": "",
       "filters": {
    	    	"year": {
    	    		"from": 2000,
    	    		"to": 2011
    	    	}
    	    
    	}
    } 

Here's the resulting response

{
    "meta": {
        "alerts": [],
        "warnings": [],
        "page": {
            "current": 1,
            "total_pages": 1,
            "total_results": 2,
            "size": 10
        },
        "engine": {
            "name": "test2",
            "type": "default"
        },
        "request_id": "a33f30a5-062f-4f09-817a-57f5318940c4"
    },
    "results": [
        {
            "standard_seating": {
                "raw": "5"
            },
            "to": {
                "raw": null
            },
            "fuel_capacity": {
                "raw": "16.50 gallons"
            },
            "driveline": {
                "raw": null
            },
            "latitude": {
                "raw": ""
            },
            "address": {
                "raw": ""
            },
            "_meta": {
                "id": "8436",
                "engine": "test2",
                "score": 1.0
            },
            "id": {
                "raw": "8436"
            },
            "images": {
                "raw": "[\"image-1.jpg\",\"image-2.jpg\",\"image-3.jpg\",\"image-4.jpg\",\"image-5.jpg\",\"image-6.jpg\",\"image-7.jpg\",\"image-8.jpg\",\"image-9.jpg\",\"image-10.jpg\",\"image-11.jpg\",\"image-12.jpg\",\"image-13.jpg\",\"image-14.jpg\",\"image-15.jpg\",\"image-16.jpg\",\"image-17.jpg\",\"image-18.jpg\",\"image-19.jpg\",\"image-20.jpg\",\"image-21.jpg\",\"image-22.jpg\",\"image-23.jpg\",\"image-24.jpg\",\"image-25.jpg\",\"image-26.jpg\",\"image-27.jpg\",\"image-28.jpg\",\"image-29.jpg\",\"image-30.jpg\",\"image-31.jpg\",\"image-32.jpg\",\"image-33.jpg\",\"image-34.jpg\",\"image-35.jpg\",\"image-36.jpg\",\"image-37.jpg\",\"image-38.jpg\",\"image-39.jpg\",\"image-40.jpg\",\"image-41.jpg\",\"image-42.jpg\",\"image-43.jpg\",\"image-44.jpg\",\"image-45.jpg\",\"image-46.jpg\",\"image-47.jpg\",\"image-48.jpg\"]"
            },
            "stock_number": {
                "raw": "2282D"
            },
            "careport": {
                "raw": ""
            },
            "dealer_id": {
                "raw": "20"
            },
            "state": {
                "raw": ""
            },
            "body_type": {
                "raw": "Sport Utility"
            },
            "vin": {
                "raw": "1FMKA99595"
            },
            "history": {
                "raw":""
            },
            "image_updated_at": {
                "raw": "2020-01-29T12:05:28+00:00"
            },
            "interior": {
                "raw": "Tan"
            },
            "fuel_type": {
                "raw": "Regular Unleaded"
            },
            "city": {
                "raw": ""
            },
            "make": {
                "raw": "Ford"
            },
            "model": {
                "raw": "Escape"
            },
            "brake_system": {
                "raw": "4-Wheel ABS"
            },
            "from": {
                "raw": "2020-01-28 12:06:29"
            },
            "vehicle_updated_at": {
                "raw": "2020-03-26T12:07:51+00:00"
            },
            "dealer": {
                "raw": ""
            },
            "longitude": {
                "raw": ""
            },
            "exterior_color": {
                "raw": "Gray"
            },
            "status_id": {
                "raw": "3"
            },
            "interior_color": {
                "raw": "Charcoal"
            },
            "phone": {
                "raw": ""
            },
            "style": {
                "raw": "No data"
            },
            "engine": {
                "raw": "4 Cylinder 2.5L"
            },
            "city_mileage": {
                "raw": "19 miles/gallon"
            },
            "status": {
                "raw": "CERTIFIED"
            },
            "trim": {
                "raw": "XLT"
            },
            "transmission": {
                "raw": null
            },
            "highway_mileage": {
                "raw": "25 miles/gallon"
            },
            "color": {
                "raw": "Charcoal"
            },
            "mileage": {
                "raw": 146651.0
            },
            "year": {
                "raw": 2009.0
            },
            "location": {
                "raw": ""
            },
            "price": {
                "raw": 4395.0
            },
            "zip": {
                "raw": ""
            }
        },
        {
            "standard_seating": {
                "raw": null
            },
            "to": {
                "raw": null
            },
            "fuel_capacity": {
                "raw": null
            },
            "driveline": {
                "raw": null
            },
            "latitude": {
                "raw": ""
            },
            "address": {
                "raw": ""
            },
            "_meta": {
                "id": "7371",
                "engine": "test2",
                "score": 1.0
            },
            "id": {
                "raw": "7371"
            },
            "images": {
                "raw": "[\"1601221197.jpg\",\"1601220984.jpg\",\"1601221188.jpg\",\"1601221172.jpg\",\"1601221147.jpg\",\"1601221012.jpg\",\"1601221108.jpg\",\"1601221110.jpg\",\"1601221208.jpg\",\"1601221130.jpg\",\"1601221168.jpg\",\"1601221122.jpg\",\"1601221169.jpg\"]"
            },
            "stock_number": {
                "raw": ""
            },
            "careport": {
                "raw": ""
            },
            "dealer_id": {
                "raw": "17"
            },
            "state": {
                "raw": ""
            },
            "body_type": {
                "raw": "4dr Car"
            },
            "vin": {
                "raw": "2T1C061034"
            },
            "history": {
                "raw": null
            },
            "image_updated_at": {
                "raw": "2020-02-26T22:23:21+00:00"
            },
            "interior": {
                "raw": "Gray"
            },
            "fuel_type": {
                "raw": null
            },
            "city": {
                "raw": ""
            },
            "make": {
                "raw": "Toyota"
            },
            "model": {
                "raw": "Corolla"
            },
            "brake_system": {
                "raw": null
            },
            "from": {
                "raw": "2019-12-24 08:11:22"
            },
            "vehicle_updated_at": {
                "raw": "2020-04-01T08:05:53+00:00"
            },
            "dealer": {
                "raw": ""
            },
            "longitude": {
                "raw": ""
            },
            "exterior_color": {
                "raw": "Blue"
            },
            "status_id": {
                "raw": "3"
            },
            "interior_color": {
                "raw": "Black"
            },
            "phone": {
                "raw": ""
            },
            "style": {
                "raw": null
            },
            "engine": {
                "raw": "4 Cylinder 1.8L"
            },
            "city_mileage": {
                "raw": null
            },
            "status": {
                "raw": "CERTIFIED"
            },
            "trim": {
                "raw": null
            },
            "transmission": {
                "raw": null
            },
            "highway_mileage": {
                "raw": null
            },
            "color": {
                "raw": "Blue"
            },
            "mileage": {
                "raw": 140594.0
            },
            "year": {
                "raw": 2014.0
            },
            "location": {
                "raw": ""
            },
            "price": {
                "raw": 8999.0
            },
            "zip": {
                "raw": ""
            }
        }
    ]
}

And here's a picture of the schema from the UI

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