티스토리 뷰
term : 정확하게 맞는 검색어 질의
match : 검색어 분석후 질의
match_phrase : 검색어 분석후 질의
0.terms(복수개의 term 검색)
{
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
{
"terms": {
"tagInfo.tags": [
"냉장고"
]
}
}
]
}
}
]
}
}
}
0-1.terms고 검색한 내용중 userId로 집계(aggregation)
{
"from": 0,
"size": 0,
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
{
"terms": {
"tagInfo.tags": [
"냉장고"
]
}
}
]
}
}
]
}
},
"aggs": {
"group_by_page.hostname": {
"terms": {
"field": "userId",
"order": {
"_count": "desc"
}
}
}
}
}
1.info.siteSeq / logType / range로 조회
{
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
{
"term": {
"info.siteSeq": {
"value": -48,
"boost": 1
}
}
},
{
"term": {
"logType": {
"value": "join",
"boost": 1
}
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
},
{
"range": {
"timestamp": {
"from": 1555340400000,
"to": 1555426799000,
"include_lower": true,
"include_upper": true,
"boost": 1
}
}
}
],
"adjust_pure_negative": true,
"boost": 1
}
}
}
2.Custom.og:title으로 키워드 부분 검색
{
"query": {
"bool": {
"should": [
{
"match_phrase": {
"custom.og:title": "롯데홈쇼핑"
}
},
{
"match_phrase": {
"custom.og:title": "홈쇼핑"
}
}
]
}
}
}
3. Page.hostname으로 group 후 내리차순으로 상위 3개만 추출
{
"size": 0,
"aggs": {
"group_by_page.hostname": {
"terms": {
"field": "page.hostname",
"size": 3,
"order": {
"_count": "desc"
}
}
}
}
}
# 여러개 컬럼 동시 검색
{
"size": 1000,
"sort": {
"timestamp": "asc"
},
"query": {
"bool": {
"filter": [
{
"bool": {
"must": [
{
"term": {
"info.siteSeq": 155056
}
},
{
"term": {
"logType": "purchase"
}
}
]
}
},
{
"range": {
"timestamp": {
"from": "2019-01-01 09:00",
"to": "2019-04-30 00:00",
"format": "yyyy-MM-dd HH:mm",
"include_lower": "true",
"include_upper": "true",
"boost": 1
}
}
}
]
}
}
}
'Data > ELK' 카테고리의 다른 글
[ELK] Elasticsearch 노드의 종류 (0) | 2023.12.18 |
---|---|
[에러 해결] Bulk indexing has failures. Use ElasticsearchException.getFailedDocuments() (0) | 2023.12.18 |
ES 인덱스 내부 데이터 싹 삭제하기 (1) | 2023.12.08 |
[ELK] 빅데이터 플랫폼에서의 엘라스틱 스택의 사용 (0) | 2023.06.14 |
[ELK] 엘라스틱 스택(ELK) 이란? (0) | 2023.06.13 |