Hi,
Following is my query
GET product_detail_info/_search
{
"query": {
"multi_match": {
"query": "a",
"fields": ["item_name", "description","cat_name","item_details"]
}
},
"aggs": {
"search_result": {
"terms": {
"field": "product_id"
}
}
}
}
I am new to elasticsearch its my assumption it should work like group by clause in sql but its returning all data ( multiple record with same product id ) following are the response.
[
{
"_index" : "product_detail_info",
"_type" : "doc",
"_id" : "41638564138017228075",
"_score" : 8.214151,
"_source" : {
"brand_id" : 232,
"item_id" : 8564,
"item_details" : """
<ul>
<li>95% cotton; 5% spandex</li>
<li>A-line style</li>
<li>Zip closure</li>
<li>Imported</li>
</ul>
""",
"document_id" : "41638564138017228075",
"item_image" : "5a9932bd107ad.png",
"pro_updated_date" : "2020-03-04T19:23:12.000Z",
"image_sort_order" : 1,
"image_product_name" : "5a97d4efba0e6.jpg",
"item_size_id" : 8075,
"updated_at" : "2020-03-04T19:23:12.000Z",
"control_number" : "STS6689",
"@version" : "1",
"item_color_id" : 1722,
"description" : "<p>A godet panel adds volume to this slim A-line denim mini that’s equally modern and preppy.</p>",
"image_id" : 4163,
"item_color_image" : "5a97d4b41e9f9.jpg",
"image_title" : "Sugar Lips_STS6689_Pink_WR_R_FLAT-375x475",
"item_v4_size_title" : "S",
"item_sku" : "SS8564",
"product_id" : 1380,
"shopify_product_id" : 3958192767043,
"item_name" : "Sugar Lips Put a Bow on It Skirt",
"cat_shopify_collection_id" : null,
"item_price" : 56.0,
"display_product_color_id" : 1722,
"cat_name" : "Mini",
"@timestamp" : "2020-04-01T11:50:03.562Z",
"gender" : "f"
}
},
{
"_index" : "product_detail_info",
"_type" : "doc",
"_id" : "41638565138017228076",
"_score" : 7.8401,
"_source" : {
"brand_id" : 232,
"item_id" : 8565,
"item_details" : """
<ul>
<li>95% cotton; 5% spandex</li>
<li>A-line style</li>
<li>Zip closure</li>
<li>Imported</li>
</ul>
""",
"document_id" : "41638565138017228076",
"item_image" : "5a9932bb3fd65.png",
"pro_updated_date" : "2020-03-04T19:23:12.000Z",
"image_sort_order" : 1,
"image_product_name" : "5a97d4efba0e6.jpg",
"item_size_id" : 8076,
"updated_at" : "2020-03-04T19:23:12.000Z",
"control_number" : "STS6689",
"@version" : "1",
"item_color_id" : 1722,
"description" : "<p>A godet panel adds volume to this slim A-line denim mini that’s equally modern and preppy.</p>",
"image_id" : 4163,
"item_color_image" : "5a97d4b41e9f9.jpg",
"image_title" : "Sugar Lips_STS6689_Pink_WR_R_FLAT-375x475",
"item_v4_size_title" : "M",
"item_sku" : "SS8565",
"product_id" : 1380,
"shopify_product_id" : 3958192767043,
"item_name" : "Sugar Lips Put a Bow on It Skirt",
"cat_shopify_collection_id" : null,
"item_price" : 56.0,
"display_product_color_id" : 1722,
"cat_name" : "Mini",
"@timestamp" : "2020-04-01T11:50:03.562Z",
"gender" : "f"
}
]
help will be highly appreciated. I was expected it will work like group by clause.
thanks