elastic_tutorial/The Elasticsearch Documentation/3_Medium/3_aggs.es
2025-04-09 09:37:23 +03:30

41 lines
858 B
Erlang
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
GET /firstindex/_search
{
"aggs": {
"citys": {
"terms": {
"field": "city",
"size": 10000
}
}
}
}
// citys - > name
// میگوید بر اساس "field": "city" دسته بندی کند - > 10 تا تهران، 20 تا قم و....
// "size": 10000 - > فقط 10000 تای اول
// size default 10 هست
GET /users/_search
{
"aggs": {
"citys": {
"terms": {
"field": "city",
"size": 10000
}
},
"ten_years": {
"terms": {
"field": "age"
}
}
}
}
// هر دو را میگوید
// !!!!!
// Note: aggs روی فیلد های text کار نمیکند
// برای استفاده در فیلد های text, type field باید keword باشد