elasticsearch


Elasticsearch scoped aggregation not desired results


I have the following query but the aggregation doesn't seem to be acting on top of the query.
The query returns 3 results there are 10 items in the aggregation. Looks like the aggregation is acting on top of all queried results.
Basically, how do I get the aggregation to take the given query as the input?
{
"query": {
"filtered": {
"filter": {
"and": [
{
"geo_distance": {
"coordinates": [
-79.3931,
43.6709
],
"distance": "15km"
}
},
{
"term": {
"user.type": "2"
}
}
]
},
"query": {
"match": {
"user.shoes": "314"
}
}
}
},
"aggs": {
"dedup": {
"terms": { "field": "user.id" }
"aggs": {
"dedup_docs": {
"top_hits": {
"size": 1
}
}
}
}
}
}
So as it turns out, I was expecting the aggregation to act on the paginated results given by the query. And that's incorrect.
The aggregation takes as input "all results" of the query, not just the paginated one.

Related Links

Elasticsearch - combining query_string and bool query in filter
Issue while querying on a field that store a file path on ElasticSearch
elasticsearch/logstash and logstash-contrib: Couldn't find any plugin named 'x'
What is the difference between Lucene and Elasticsearch
Cannot create Phoenix JDBC river in Elasticsearch
Disabling field analyzing by default in elastic search
time difference in elasticsearch took and that calculated manually
elasticsearch comparison between fields
Find all ID where ID are not in my blacklist
How to order results by custom value and then by _score
Kibana homepage shows blank after deleting all indices
elasticsearch: update in a nested object (HTTP)
Using Phoenix to help to integrate elastic-search and Hbase. When use sqlline.py,to create table, bad happens
Shards and replicas elastic search
Elasticsearch Completion Suggester - Sort suggestions
Can _score from different queries be compared?

Categories

HOME
php
xpath
mc
opencart
yahoo-weather-api
dotnetnuke
antd
google-search-console
elastic-load-balancer
azure-graph-api
clish
buffer
powermock
rest-assured
android-contacts
gravity
spring-shell
yii2-basic-app
gollum-wiki
raima
ipa
background-color
offline-caching
sap-lumira
jackrabbit-oak
region
monitor
nic
autodesk-model-derivative
infopath2010
john-the-ripper
knights-tour
osx-lion
forms-authentication
sspi
opal-framework
type-inference
dredd
ol3-google-maps
knockout-2.0
beeline
asp.net-web-api-routing
nivo-slider
alertify
nrf51
mifos
ipywidgets
between
dpkg
fiber
static-methods
swiffy
seadragon
phpquery
juniper-network-connect
asp.net-web-api-helppages
fantom
whitespace-language
shell-extensions
signed
incron
phonegap-facebook-plugin
fasterxml
comctl32
storing-data
network-printers
forio-contour
hyperloglog
wso2bam
void-pointers
flv
dojo-1.9
ckeditor.net
semantic-merge
onconfigurationchanged
clrprofiler
sfinae
jzmq
dip
ccnet-config

Resources

Encrypt Message