elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
69.91k stars 24.73k forks source link

How to search a field in elastic search #9574

Closed rthneha closed 9 years ago

rthneha commented 9 years ago

here is my object:

when i hit below query :

http://192.168.0.94:9200/pf_sales_data_index/pf_sales_data/_search?pretty=true -d ' { "query": { "bool": { "must": [ { "match": { "Brand":"Supermax" } } ] } } }'

I get below result: Actually i want to filter only Brand having this specific value. But its not fitering

{ "took" : 3, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 43645, "max_score" : 1.0, "hits" : [ { "_index" : "pf_sales_data_index", "_type" : "pf_sales_data", "_id" : "m_ySXAl9Q0OzkFUjiZHfzw", "_score" : 1.0, "_source":{"Shipping Charges":"0.0000","CouponDiscount":"0","Brand":"Swayam","Sell Price":"679.0000","product_id":"1021408","Max Ship Days":"3","Base_Price":"679.0000","Magento Order Status":"shipped","Actual Shipment Date":"2014-01-28","Pincode":"632002","attribute_set_name":"Furnishings","amount_grand_total":"12109.0000","Product Name":"Swayam Solid Yellow Solid Eyelet Window Curtain- 5 Ft","OrderDateTime":"2014-01-24 19:34:21.0","SKU_status":"Delivered","amount_paid":"12109.0000","auction_item":"","Customer Status":"Logged In","TS Buyer Name":"Heena Sohandani","gateway_name":"Citrus","CODCollect":"2037.00","Warehouse Name":"Delhi","Supplier SKU ID":"Swayam-CURW - P5203","cost_tax_type_percent":"2%","Supplier SKU Name":"Swayam-CURW - P5203","Confirmation date":"2014-01-24 19:36:08.0","OldSKU":"FUM1148DE317380","CODShipping":"0.00","Customer Name":"Cassandra Solomons","cost":"561.8800","order_currency_code":"INR","user_flag":"","PP":"0","Customer Email":"cassie_gem@mailinator.com","Base_cost":"550.8600","Magento SKU Status":"REFUND","Phone":"0000000000","SKU ID":"FU1021408-P-OD2111","Courier":"Gati","coupon_code":"REPUB15","Order Date":"2014-01-24","Dispatch Date":"","Old Order Id":"","Order ID - SKU ID":"300248115-FU1021408-P-OD2111","effective_cost_price":"561.8800","Coupon Rule Name":"22Jan14_Vip_FDFK_15Per","AWB":"529038695","method_code":"NET_BANKING","max ship date":"2014-02-03","rowtotal":"2037.00","tax_amount":"11.02","direct_ship":"No","OFT SKU Status":"","Seller Name":"Prakruti","row_total":"13400.0000","amount_customer_due":"10072.0000","give_india":"0.0000","tax_type":"CST","option_name":"State Bank of India","Order Qty":"3.0000","Stock Type":"market place","OFT Remarks":"","Pay Method":"citrus","Invoice Number":"","City":"Vellore","Supplier Name":"Linen Design Co. Pvt. Ltd.","State":"Tamil Nadu","Supplier ID":"2111","SOR":"No","Address":"529, Mango Road , CMC College Campus, Bagayam","cat_map":"Furnishings/Curtains /Window Curtains","Order ID":"300248115"} }, { "_index" : "pf_sales_data_index", "_type" : "pf_sales_data", "_id" : "ltk5qx20TkSS6h0I6CWkaA", "_score" : 1.0, "_source":{"Shipping Charges":"0.0000","CouponDiscount":"0","Brand":"Vaadi herbals","Sell Price":"99.0000","product_id":"1105762","Max Ship Days":"3","Base_Price":"99.0000","Magento Order Status":"canceled","Pincode":"560037","attribute_set_name":"Personal Care","amount_grand_total":"99.0000","Product Name":"Vaadi Herbals Almond And Honey Soap With Aloe Vera - Pack Of 6 Soaps","OrderDateTime":"2014-01-24 19:35:33.0","SKU_status":"Ordered","amount_paid":"0.0000","auction_item":"","Customer Status":"Logged In","TS Buyer Name":"Sandeep Kumbhar","gateway_name":"Citrus","CODCollect":"99.00","Warehouse Name":"Delhi","Supplier SKU ID":"Vaadi Herbals Super Value Pack Of Almond And Honey Soap With Aloe Vera (Set Of 6)","cost_tax_type_percent":"12.50%","Supplier SKU Name":"Vaadi Herbals Super Value Pack Of Almond And Honey Soap With Aloe Vera (Set Of 6)","OldSKU":"","CODShipping":"0.00","Customer Name":"Senthil N","cost":"78.0000","order_currency_code":"INR","user_flag":"","PP":"0","Customer Email":"senthilnkumar@mailinator.com","Base_cost":"69.3300","Magento SKU Status":"canceled","Phone":"0000000000","SKU ID":"BB1105762-P-OD1907","coupon_code":"","Order Date":"2014-01-24","Dispatch Date":"","Old Order Id":"","Order ID - SKU ID":"300248119-BB1105762-P-OD1907","effective_cost_price":"69.3300","method_code":"NET_BANKING","max ship date":"0000-00-00","rowtotal":"99.00","tax_amount":"8.67","direct_ship":"No","OFT SKU Status":"","Seller Name":"Prakruti","row_total":"99.0000","amount_customer_due":"99.0000","give_india":"0.0000","tax_type":"VAT","option_name":"State Bank of India","Order Qty":"1.0000","Stock Type":"market place","OFT Remarks":"","Pay Method":"citrus","Invoice Number":"","City":"Bangalore","Supplier Name":"Vaadi Herbals Pvt Ltd","State":"Karnataka","Supplier ID":"1907","SOR":"No","Address":"C401,Nagarjuna Serene, 9th Main, Opp RJ College Tulsi Theatre Road,Marathalli","cat_map":"Bath \u0026 Body/Bathing Products/Soaps","Order ID":"300248119"} }, { "_index" : "pf_sales_data_index", "_type" : "pf_sales_data", "_id" : "PuQYLP0ATCuvCN9b6BOrJw", "_score" : 1.0, "_source":{"Shipping Charges":"0.0000","CouponDiscount":"0","Brand":"Supermax","Sell Price":"69.0000","product_id":"1074052","Max Ship Days":"4","Base_Price":"69.0000","Magento Order Status":"declined_payment","Pincode":"380008","attribute_set_name":"Personal Care","amount_grand_total":"69.0000","Product Name":"Supermax SMX 3 Tripple Blade Razor With 10 Cartridges","OrderDateTime":"2014-01-24 19:39:34.0","SKU_status":"Ordered","amount_paid":"0.0000","auction_item":"","Customer Status":"Logged In","TS Buyer Name":"Sandeep Kumbhar","gateway_name":"Citrus","CODCollect":"69.00","Warehouse Name":"Maharashtra","Supplier SKU ID":"SMX_1","cost_tax_type_percent":"12.50%","Supplier SKU Name":"SMX_1","OldSKU":"","CODShipping":"0.00","Customer Name":"chirag kapadne","cost":"60.0000","order_currency_code":"INR","user_flag":"","PP":"0","Customer Email":"chirag.kapadne@mailinator.com","Base_cost":"53.3300","Magento SKU Status":"canceled","Phone":"0000000000","SKU ID":"BB1074052-P-OD2240","coupon_code":"","Order Date":"2014-01-24","Dispatch Date":"","Old Order Id":"","Order ID - SKU ID":"300248123-BB1074052-P-OD2240","effective_cost_price":"53.3300","method_code":"DEBIT_CARD","max ship date":"0000-00-00","rowtotal":"69.00","tax_amount":"6.67","direct_ship":"No","OFT SKU Status":"","Seller Name":"Prakruti","row_total":"69.0000","amount_customer_due":"69.0000","give_india":"0.0000","tax_type":"VAT","option_name":"Master","Order Qty":"1.0000","Stock Type":"market place","OFT Remarks":"","Pay Method":"citrus","Invoice Number":"","City":"Ahmedabad","Supplier Name":"S cube Care","State":"Gujrat","Supplier ID":"2240","SOR":"No","Address":"14,Nilambar duplex, Behind garvi gujarat society, Near jashoda nagar canal road, Maninagar East,","cat_map":"Bath \u0026 Body/Mens Shaving/Razors \u0026 Cartridges","Order ID":"300248123"} }, { "_index" : "pf_sales_data_index", "_type" : "pf_sales_data", "_id" : "ZEZ0OcmfSweEflwPZu3BXw", "_score" : 1.0, "_source":{"Shipping Charges":"0.0000","CouponDiscount":"5622","Brand":"Eden","Sell Price":"21623.0000","product_id":"1060299","Max Ship Days":"10","Option":"mattress_size","Base_Price":"21623.0000","Magento Order Status":"declined_payment","Pincode":"400050","attribute_set_name":"Mattresses","amount_grand_total":"49843.0000","Product Name":"Eden Pocket Spring Mattress (Pocket 6 Inches- Queen) - 78 x 60 x 6","OrderDateTime":"2014-01-24 20:11:54.0","SKU_status":"Ordered","amount_paid":"0.0000","auction_item":"","Customer Status":"Guest","Option Value":"78 x 60 x 6","TS Buyer Name":"Abhishek Dasgupta","gateway_name":"Citrus","CODCollect":"16001.02","Warehouse Name":"Delhi","Supplier SKU ID":"Pocket 6\"-78 x 60 X 6","cost_tax_type_percent":"","Supplier SKU Name":"Eden Pocket Spring Mattress (Pocket 6 Inches- Queen)","CODShipping":"0.00","Customer Name":"Amit Agarwal","cost":"14054.9500","order_currency_code":"INR","user_flag":"","PP":"0","Customer Email":"Amit2agarwal@mailinator.com","Base_cost":"14054.9500","Magento SKU Status":"canceled","Phone":"0000000000","SKU ID":"FU1060294-S-PM2154-78 x 60 X 6","coupon_code":"PRIDE26","Order Date":"2014-01-24","Dispatch Date":"","Old Order Id":"","Order ID - SKU ID":"300248145-FU1060294-S-PM2154-78 x 60 X 6","effective_cost_price":"14054.9500","Coupon Rule Name":"20Jan14_Promo_Republic_Mudra_26_Max10000","method_code":"DEBIT_CARD","max ship date":"0000-00-00","rowtotal":"16001.02","tax_amount":"0.00","direct_ship":"No","OFT SKU Status":"","Seller Name":"INDIA MATTRESS COMPANY","row_total":"67356.0000","amount_customer_due":"49843.0000","give_india":"0.0000","tax_type":"","option_name":"Master","Order Qty":"1.0000","Stock Type":"market place","OFT Remarks":"","Pay Method":"citrus","Invoice Number":"","City":"Mumbai","Supplier Name":"INDIA MATTRESS COMPANY","State":"Maharashtra","Supplier ID":"2154","SOR":"No","Address":"1001 Vinayak Heights, Nargis Dutt Road, Pali Hill , Bandra West","cat_map":"Furnishings/Mattresses","Order ID":"300248145"} }, { "_index" : "pf_sales_data_index", "_type" : "pf_sales_data", "_id" : "ryMbTOVzRKqC_nyUw6OBJw", "_score" : 1.0, "_source":{"Shipping Charges":"0.0000","CouponDiscount":"728","Brand":"Mudra","Sell Price":"2799.0000","product_id":"1059039","Max Ship Days":"15","Base_Price":"2799.0000","Magento Order Status":"shipped","Actual Shipment Date":"2014-01-29","Pincode":"736101","attribute_set_name":"Furniture","amount_grand_total":"2071.0000","Product Name":"Cayenne Charming Little Stool","OrderDateTime":"2014-01-24 20:23:03.0","SKU_status":"Delivered","amount_paid":"2071.0000","auction_item":"","Customer Status":"Logged In","TS Buyer Name":"Hussaine Kesury","gateway_name":"Citrus","CODCollect":"2071.26","Ship to Hub Date":"2014-01-27","Warehouse Name":"Rajasthan","Supplier SKU ID":"26112_","cost_tax_typepercent":"0%","Supplier SKU Name":"26112","Confirmation date":"2014-01-24 20:23:53.0","OldSKU":"FM1031021-P-OD1348","CODShipping":"0.00","Customer Name":"DEBASHREE ROY","cost":"1100.0000","order_currency_code":"INR","user_flag":"","PP":"0","Customer Email":"dr.debashreeroy@mailinator.com","Base_cost":"1100.0000","Magento SKU Status":"SHIPPED","Phone":"0000000000","SKU ID":"FM1059039-P-WH2194","Courier":"Bluedart","coupon_code":"PRIDE26","Order Date":"2014-01-24","Dispatch Date":"","Old Order Id":"","Order ID - SKU ID":"300248158-FM1059039-P-WH2194","effective_cost_price":"1100.0000","Coupon Rule Name":"20Jan14_Promo_Republic_Mudra_26_Max10000","AWB":"69067263414","method_code":"DEBIT_CARD","max ship date":"2014-01-29","rowtotal":"2071.26","tax_amount":"0.00","direct_ship":"No","OFT SKU Status":"","Seller Name":"Prakruti","row_total":"2799.0000","amount_customer_due":"0.0000","give_india":"0.0000","tax_type":"VAT","option_name":"Visa","Order Qty":"1.0000","Stock Type":"ware house","OFT Remarks":"","Pay Method":"citrus","Invoice Number":"","City":"COOCHBEHAR","Supplier Name":"APPU ART \u0026 HANDICRAFTS","State":"West Bengal","Supplier ID":"2194","SOR":"No","Address":"C/O SISIR SARKAR, DEBIBARI ROAD(NORTH) \n COOCHBEHAR","cat_map":"Furniture/Pouffe \u0026 Stools","Order ID":"300248158"} } ] } }

abhijitiitr commented 9 years ago

@rthneha Index your Brand attributes as not_analyzed and use a term filter subsequently on Brand.

dadoonet commented 9 years ago

And please use the mailing list for questions.