How to get count of total records without size in elastic search

I want to get count of total records from elastic search.
Executing manual query is giving 400 records whereas elastic search giving 10 records. How do I get total records regardless of size.?

Can you share the exact response of elasticsearch ?

@dadoonet
> [searchfound] => 2

        [result] => Array
            (
                [0] => Array
                    (
                        [prod_id] => 
                        [lang_id] => 1
                        [manuf_id] => 5
                        [cat_type_id] => 1
                        [cat_id] => 10
                        [network_id] => 3
                        [comp_group_id] => 0
                        [prod_name] => Samsung E250 Black On Orange PAYG Mobile Phone
                        [prod_short_name] => 
                        [prod_color] => 0
                        [prod_seo_name] => Samsung-e250-black-orange-payg
                        [prod_model] => E250
                        [prod_video_url] => 
                        [prod_purchase_price] => 53.00
                        [prod_reseller_price] => 0.00
                        [prod_retail_price] => 27.08
                        [prod_sp_offer_price] => 999.00
                        [prod_credit] => 0.00
                        [prod_stock_qty] => 0
                        [prod_alert_at_qty] => 0
                        [prod_univ_comptability] => 0
                        [prod_preorder] => 0
                        [prod_preorder_text] => 
                        [prod_have_specs] => 0
                        [prod_discount_flag] => 0
                        [prod_ships_in] => 1
                        [prod_mpn] => Samsung E250 Black Orange PAYG
                        [prod_newarrival] => No
                        [prod_supersaver] => No
                        [prod_best] => No
                        [prod_sku] => 
                        [prod_ean] => 5037808910007
                        [prod_ean_type] => autogenerated
                        [prod_type] => Consumer Electronics
                        [prod_node] => 564420
                        [prod_rating] => 4
                        [prod_insurance_id] => 1
                        [prod_latest] => 0
                        [prod_best_selling] => 0
                        [prod_best_deal] => 0
                        [prod_added_on] => 2010-12-27 07:15:06
                        [prod_bundle_ids] => 
                        [prod_upd_user_id] => 17
                        [prod_upd_datetime] => 2011-02-04 12:55:48
                        [prod_status] => 0
                        [is_comp_phone] => 0
                        [is_excluded] => 0
                        [parent_prod_id] => 0
                        [is_canonical] => 0
                        [product_for] => 
                        
                    )
    )

It does not look like an elasticsearch answer. Could you produce the JSON response from elasticsearch please?

Actually I am new to elastic search.

Below is my URL:

http://example.com/ppm2.0/search.html?q=samsung-e250-black-on-orange-payg-mobile-phone

It is in PHP and returning an array. I don't know how can I produce in JSON.

below is my elasic search:

 $params = [
                'index' => $this->client->getIndex(),
                'type'  => $this->client->getType(),
				"from" => 0, "size" => 1000,
				//"scroll" => "1m",

                'body'  => [
               "query" => [
				   "bool" => [
					  "must" => [
						 [
							  "multi_match" => [
								  "fields" => ["prod_name", "prod_seo_name"],
								  "type" => "phrase_prefix",
								  "query" => $query
							  ]
						 ],
						 [
							  "term"=> ["cat_type_id"=>1]
						 ]
					  ]
				   ]
				]
				],
           ];

Could you provide a full recreation script as described in

It will help to better understand what you are doing.
Please, try to keep the example as simple as possible.

"query" :{
	 "bool" :{
		  "must" :{
			   {
			      "multi_match" :{
				                "fields" : ["prod_name", "prod_seo_name"],
						 "type" : "phrase_prefix",
						 "query" : 'Samsung Mobile'
						  }
			    },
			    {
				 "term": ["cat_type_id"=>1]
			     }
			     }
			   }
			}

I can't help.

Please reproduce the problem and share the output from elasticsearch. Not anything that your application is parsing/changing.

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