일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- ELASTIC
- sort
- query
- License
- license delete
- TensorFlow
- springboot
- Elasticsearch
- MySQL
- docker
- analyzer test
- API
- zip 파일 암호화
- aggregation
- 차트
- Kafka
- flask
- high level client
- 900gle
- licence delete curl
- aggs
- Java
- Mac
- zip 암호화
- plugin
- Python
- token filter test
- matplotlib
- Test
- 파이썬
Archives
- Today
- Total
개발잡부
[es] nested aggregation 본문
반응형
검색쿼리
GET /products_nested/_search?size=0
{
"query": {
"match": {
"name": "led tv"
}
},
"aggs": {
"resellers": {
"nested": {
"path": "resellers"
},
"aggs": {
"filter_reseller": {
"filter": {
"bool": {
"filter": [
{
"term": {
"resellers.reseller": "companyB"
}
}
]
}
},
"aggs": {
"min_price": {
"min": {
"field": "resellers.price"
}
},
"resller": {
"terms": {
"field": "resellers.reseller",
"size": 10
}
}
}
}
}
}
}
}
PUT /products_nested
{
"settings": {
"index": {
"number_of_shards": 3,
"number_of_replicas": 0
}
},
"mappings": {
"properties": {
"resellers": {
"type": "nested",
"properties": {
"reseller": {
"type": "keyword"
},
"price": {
"type": "double"
}
}
}
}
}
}
PUT /products_nested/_doc/0?refresh
{
"name": "LED TV",
"resellers": [
{
"reseller": "companyA",
"price": 350
},
{
"reseller": "companyB",
"price": 500
}
]
}
PUT /products_nested/_doc/1?refresh
{
"name": "ODIO RADIO",
"resellers": [
{
"reseller": "companyA",
"price": 150
},
{
"reseller": "companyC",
"price": 550
}
]
}
반응형
'ElasticStack > Elasticsearch' 카테고리의 다른 글
[es] aggregation test 3 (0) | 2022.07.19 |
---|---|
[es] aggregation test 2 (0) | 2022.07.17 |
[es] aggregation test 1 (0) | 2022.07.16 |
[es] Array Aggregations (0) | 2022.07.15 |
[es] Aggregations (0) | 2022.07.14 |
Comments