안녕하세요, 내 웹 사이트에서 검색 창을 만들려고합니다. 나는 수천 건의 회사 기사를 가지고있다.탄성 검색 집계 및 필터
GET articles/_search
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "assistant",
"fields": ["title"]
}
}
]
}
},
"size": 0,
"aggs": {
"by_company": {
"terms": {
"field": "company.keyword",
"size": 10
}
}
}
}
결과는 다음과 같습니다 :이 코드를 실행하면 이제
"aggregations": {
"by_company": {
"doc_count_error_upper_bound": 5,
"sum_other_doc_count": 409,
"buckets": [
{
"key": "University of Miami",
"doc_count": 6
},
{
"key": "Brigham & Women's Hospital(BWH)",
"doc_count": 4
},
을 나는 그래서 난 쿼리를 다음 실행할 마이애미 대학의 필터 기사 싶어 :
GET indeed_psql/job/_search
{
"query": {
"bool": {
"must": [
{
"multi_match": {
"query": "assistant",
"fields": ["title"]
}
}
],
"filter": {
"term": {
"company.keyword": "University of Miami"
}
}
}
},
"size": 0,
"aggs": {
"by_company": {
"terms": {
"field": "company.keyword",
"size": 10
}
}
}
}
하지만 지금은 결과 :
"aggregations": {
"by_company": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [
{
"key": "University of Miami",
"doc_count": 7
}
]
}
왜 갑자기 이전 집계에 있었을 때 그들 중 7 명은 6 명 이었습니까? 다른 대학 필터에서도 마찬가지입니다. 내가 도대체 뭘 잘못하고있는 겁니까 ? 표준 tokenizer를 사용하지 않고 있으며 english_stemmer, english_stopwords, english_keywords를 사용하는 필터에서. 당신의 도움을 주셔서 감사합니다.
감사합니다. U는 오늘을 구했다 :) –