Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only send filtered aggregations in search query #300

Open
svandaalen opened this issue Nov 27, 2024 · 0 comments
Open

Only send filtered aggregations in search query #300

svandaalen opened this issue Nov 27, 2024 · 0 comments

Comments

@svandaalen
Copy link
Collaborator

Only sending the filtered aggregations in the search query to 🥦 significantly increases performance. By default, about 50% of the facets are hidden, but the hidden facets are included in the search query, slowing it down unnecessarily.

An empty search query with all aggs takes about 6s:

➜  ~ time curl -LSs -o /dev/null -XPOST https://api.goetgevonden.nl/projects/republic/search\?indexName\=republic-2024.11.18\&fragmentSize\=100\&from\=0\&size\=10\&sortBy\=_score\&sortOrder\=desc --json '{"terms":{},"date":{"name":"sessionDate","from":"1576-01-10","to":"1796-01-03"},"range":{"name":"text.tokenCount","from":"0","to":"66000"},"aggs":{"textType":{"order":"countDesc","size":10},"resolutionType":{"order":"countDesc","size":10},"propositionType":{"order":"countDesc","size":10},"delegateName":{"order":"countDesc","size":10},"personName":{"order":"keyAsc","size":10},"roleName":{"order":"keyAsc","size":10},"roleCategories":{"order":"countDesc","size":10},"locationName":{"order":"keyAsc","size":10},"locationCategories":{"order":"countDesc","size":10},"organisationName":{"order":"keyAsc","size":10},"organisationCategories":{"order":"countDesc","size":10},"commissionName":{"order":"keyAsc","size":10},"commissionCategories":{"order":"countDesc","size":10},"sessionWeekday":{"order":"countDesc","size":10},"delegateId":{"order":"countDesc","size":10},"personId":{"order":"countDesc","size":10},"roleId":{"order":"countDesc","size":10},"locationId":{"order":"countDesc","size":10},"organisationId":{"order":"countDesc","size":10},"commissionId":{"order":"countDesc","size":10},"bodyType":{"order":"countDesc","size":10},"sessionDate":{"order":"countDesc","size":10},"sessionDay":{"order":"countDesc","size":10},"sessionMonth":{"order":"countDesc","size":10},"sessionYear":{"order":"countDesc","size":250},"delegateProvince":{"order":"countDesc","size":10},"delegateIsPresident":{"order":"countDesc","size":10}}}'
curl -LSs -o /dev/null -XPOST  --json   0.02s user 0.01s system 0% cpu 6.017 total

Whilst an empty search query with only the default show/filtered aggs takes about 2.2s:

➜  ~ time curl -LSs -o /dev/null -XPOST https://api.goetgevonden.nl/projects/republic/search\?indexName\=republic-2024.11.18\&fragmentSize\=100\&from\=0\&size\=10\&sortBy\=_score\&sortOrder\=desc --json '{"terms":{},"date":{"name":"sessionDate","from":"1576-01-10","to":"1796-01-03"},"range":{"name":"text.tokenCount","from":"0","to":"66000"},"aggs":{"textType":{"order":"countDesc","size":10},"resolutionType":{"order":"countDesc","size":10},"propositionType":{"order":"countDesc","size":10},"delegateName":{"order":"countDesc","size":10},"personName":{"order":"keyAsc","size":10},"roleName":{"order":"keyAsc","size":10},"locationName":{"order":"keyAsc","size":10},"organisationName":{"order":"keyAsc","size":10},"commissionName":{"order":"keyAsc","size":10},"bodyType":{"order":"countDesc","size":10},"sessionDate":{"order":"countDesc","size":10},"sessionDay":{"order":"countDesc","size":10},"sessionMonth":{"order":"countDesc","size":10},"sessionYear":{"order":"countDesc","size":250}}}'
curl -LSs -o /dev/null -XPOST  --json   0.02s user 0.01s system 1% cpu 2.289 total
@svandaalen svandaalen assigned svandaalen and unassigned svandaalen Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant