# Search Service and Elasticsearch Shop Traits I think we'll be able to use just a nested object for storing and returning traits. The traits would be added to the current payloads and look like this: ``` { Other shop attrs... "traits": { "rating": 4.99, "retention_score": 3.99, "performance_score": 4.99, "on_time_percentage": 0.9, "retention_rank": 0.5 } ...Other shop attrs } ``` ## Elastic Search Example Response ``` { "_index": "shops_20200901_213700_509a3", "_type": "shop", "_id": "2aa84201-640e-42da-a700-45877f4c2125", "_score": 1.0, "_source": { "shop_id": 12, "shop_uuid": "2aa84201-640e-42da-a700-45877f4c2125", "location": { "lat": 36.3828852, "lon": -84.1199472 }, "created_at": "2020-09-01T21:31:11.958Z", "updated_at": "2020-09-01T21:38:09.146Z", "name": "SCOTT Pizza & Pasta", "discount_percent": 0.0, "shop_sequence_id": 6, "is_acquired": true, "disabled": true, "city": "Huron", "state": "", "zip_code": "80653", "address": "19062 La Follette Center", "delivery_zone": [], "max_delivery_estimate": 45, "max_pickup_estimate": 30, "min_delivery_estimate": 30, "min_pickup_estimate": 15, "phone": "12125553323", "slug": "isabella-s-pizza-pasta", "web_slug": "/huron/80653/isabella-s-pizza-pasta", "pickup_minimum": 0.0, "image_url": "", "hero_image_url": "", "delivery_provider": "", "shop_status": "onboarding", "schedule": { "pickup": [ { "from": "2020-09-01T11:45:00Z", "to": "2020-09-02T02:00:00Z" }, { "from": "2020-09-02T14:30:00Z", "to": "2020-09-03T02:30:00Z" }, { "from": "2020-09-03T15:45:00Z", "to": "2020-09-04T02:15:00Z" }, { "from": "2020-09-04T13:15:00Z", "to": "2020-09-05T01:30:00Z" } ], "delivery": [ { "from": "2020-09-01T05:00:00Z", "to": "2020-09-02T02:00:00Z" }, { "from": "2020-09-02T05:00:00Z", "to": "2020-09-03T01:00:00Z" }, { "from": "2020-09-03T05:00:00Z", "to": "2020-09-04T00:45:00Z" }, { "from": "2020-09-04T05:00:00Z", "to": "2020-09-05T00:45:00Z" } ] }, "chain_id": null, "chain_slug": null, "chain_name": null, "shop_type": "partner", "traits": { "rating": 4.99, "retention_score": 3.99, "performance_score": 4.99, "on_time_percentage": 0.9, "retention_rank": 0.5 } } } ``` ## Search Service Example Response ``` { "address": "740 Mifflin Street", "chain": null, "city": "Philadelphia", "cuisines": [ { "name": "healthy pizza", "seo_representation": "healthy-pizza" }, { "name": "veggie pizza", "seo_representation": "veggie-pizza" } ], "delivery_info": { "delivers_to_user": false, "fee_amount": null, "fee_range": { "max": 2.75, "min": 2.75, "type": "flat" }, "fee_type": null, "minimum_order": null, "minimum_order_range": { "max": 7.5, "min": 7.5 } }, "delivery_provider": "", "discount_percent": 0.1, "distance_to_user": 1577.7984939952778, "eta": { "max_delivery": 60, "max_pickup": 30, "min_delivery": 45, "min_pickup": 15 }, "hero_image_url": "", "id": "40204152-cbb9-4385-a4b7-5c2292904c12", "image_url": "https://shop-logos.imgix.net/shops/1663/original/South_Side_Pizza.png", "is_acquired": true, "is_open_for_delivery": true, "is_open_for_pickup": true, "location": { "latitude": 39.9253657, "longitude": -75.1591076 }, "name": "South Side Pizza", "ovr": 0.371168677081273, "pickup_minimum": 0.0, "rating_info": { "count": 458, "display": 4.82147492099133, "should_display": true, "value": 4.82147492099133 }, "shop_id": 1663, "state": "PA", "traits": { "rating": 4.99, "retention_score": 3.99, "performance_score": 4.99, "on_time_percentage": 0.9, "retention_rank": 0.5 }, "web_slug": "pa/philadelphia/19148/south-side-pizza-east", "zip_code": "19148" } ```