일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- TensorFlow
- License
- springboot
- licence delete curl
- zip 파일 암호화
- 900gle
- MySQL
- license delete
- aggs
- API
- Kafka
- high level client
- 차트
- matplotlib
- analyzer test
- 파이썬
- sort
- Python
- Test
- Java
- Mac
- token filter test
- ELASTIC
- flask
- docker
- query
- plugin
- zip 암호화
- Elasticsearch
- aggregation
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