Querying and Updating Facets in Typesense
TLDR Hafiz asked about sum/average of records, hourly grouping, and data formatting in Typesense. Kishore Nallan advised on using facet_by
, grouping methods, and bulk update options. Hafiz was unable to get sum by group but was advised to store records pre-grouped.
1
1
Dec 07, 2022 (10 months ago)
Hafiz
10:28 AMWant to know that typesense support below queries or not:
• want to get sum or average of all records in query response
• can i get group data on hourly base with sum and total matched records
If above points are possible then how or any work around?
Thanks!
Kishore Nallan
10:55 AMfacet_by
on the field you wish to get the statistics on.Kishore Nallan
10:56 AMHafiz
11:00 AMassign hour = 10 in all records between 10 am to 11 am
Kishore Nallan
11:17 AMgroup_by
on that field and then do facet_by
Hafiz
11:19 AM1
Dec 12, 2022 (10 months ago)
Hafiz
07:36 AMI have another scenario, for example i have amount column and i want to get the sum or average of that amount from all documents, can you please guide me on this?
Kishore Nallan
07:42 AMfacet_by
on the amount column.Kishore Nallan
07:43 AM*
to target all documents.Hafiz
07:43 AMKishore Nallan
07:44 AMKishore Nallan
07:44 AMHafiz
07:46 AM"stats": {
"avg": 7529.81586971587,
"max": 8301874,
"min": 0,
"sum": 108655243,
"total_values": 3162
}
above mentioned value is sum?
Kishore Nallan
07:49 AMHafiz
07:49 AM1
Dec 27, 2022 (9 months ago)
Hafiz
08:01 AMi want to get sum by group. for example
I have a sales data which include product name total amount and date. I want to get the sum of total amount by dates
Hafiz
08:02 AM"q": "*",
"query_by": "productName",
"facet_by": "totalAmount",
"group_by": "date"
}
applied above search, but not getting the desired results
Hafiz
08:06 AMKishore Nallan
08:50 AMHafiz
09:44 AMHafiz
09:44 AMHafiz
09:51 AMKishore Nallan
09:52 AMHafiz
09:53 AM{
facet_counts: [],
grouped_hits: [
{
group_key: [],
hits: []
}
]
}
Hafiz
09:53 AMKishore Nallan
09:54 AMHafiz
10:02 AM{
"name": "RequestMalformed",
"httpStatus": 400
}
Hafiz
10:04 AMHafiz
01:04 PMKishore Nallan
01:27 PMHafiz
01:58 PMTypesense
Indexed 2779 threads (79% resolved)
Similar Threads
Understanding Facet Results in Typesense
Prabhu had difficulty understanding the count results of his facet results in Typesense. Kishore Nallan explained the behaviour and suggested creating a Github issue for a feature request to modify count behaviour.
Setting dynamic range faceting in Typesense
Jacob requested dynamic range faceting in Typesense, and explanation for fetching max/min values. Kishore Nallan clarified pricing bucket sizes were user dependent and explained the stats return as part of facet results.
Improving System Performance and Typesense Query Efficiency
SamHendley was experiencing performance issues with Typesense's large-scale system testing and proposed several improvements. Both Jason and Kishore Nallan addressed the suggestions and corrected some misconceptions. They provided further clarification and recommended upgrades for better performance.
Implementing Histogram Slider with Typesense
em1nos asked about implementing a histogram slider with typesense. James suggested using facets and group by feature. Jason recommended creating a new field for price buckets to achieve the desired output using facet_counts.
Handling Large Amount of Facet Values
Dima asked about handling large amounts of facet values. Jason assured that it is fine and suggested setting `max_facet_values` to a large number.