ES 5.2: How select aggregation max with filter value


(Pashkevich Aleksandr) #1

Hello. Sorry for my English
Me need select 4 aggregation for terms
1 agg it's max value field price, where filter is_new:true
2 agg it's min value field price, where filter is_new:true

3 agg it's max value field price, where filter is_new:false
4 agg it's min value field price, where filter is_new:false
I tried this query, but this dont work:

"aggs" : {
				"p_product" : {
					"terms" : { "field" : "pr_article_search" }
					,"aggs" : {
						"max_price" : { "max" : { "field" : "pr_price_calc" }, "filter": {"term": {"pr_is_new": "1"} },
						"min_price" : { "min" : { "field" : "pr_price_calc" }, "filter": {"term": {"pr_is_new": "1"} },
						
					}
				}
				 
			}

P.s. and i try use google before create this topic


(Fanfan) #2

refer to https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-filter-aggregation.html


(Pashkevich Aleksandr) #3

Big thank you.


(system) #4

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