I am using this API "http://localhost/test/rest/V1/orders?searchCriteria[filter_groups][0][filters][0][field]=product_id&searchCriteria[filter_groups][0][filters][0][value]=24" to filter orders by product id.
But getting this message
"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'product_id' in 'where clause', query was: SELECT
main_table
.* FROMsales_order
ASmain_table
WHERE ((product_id
= '24'))".
If I am using filter on entity_id then it is working fine.I found in response that both of the fields stored at different positions.
eg. {
"items": [
{
"entity_id": 1,
"items": [
{
"product_id": 14,
}
]
}
]
}
That's why API is not accepting "product_id" filter. So how can a I apply filter on "product_id"