#community-help

Cache on Typesense and "amount" Field Issue

TLDR Max encountered a facet field error regarding the "amount" field. Kishore Nallan and James suggested checking the search query and setting "amount" as a facet: true in the schema.

Powered by Struct AI
10
7mo
Solved
Join the chat
Feb 06, 2023 (7 months ago)
Max
Photo of md5-0632b78a36980331a087faf672610530
Max
01:31 PM
Greetings, everyone šŸ‘‹
Is there something like a cache on Typesense?
I swapped my index and I'm getting
Unhandled Rejection (Error): 404 - Could not find a facet field named `amount` in the schema.

Double checked all the code - there is no reference to amount anywhere else šŸ¤·ā€ā™‚ļø
01:32
Max
01:32 PM
  22 | try {
  23 |   typesenseResponse = await this._adaptAndPerformTypesenseRequest(instantsearchRequests);
  24 | 
> 25 |   const adaptedResponses = typesenseResponse.results.map((typesenseResult, index) => {
     | ^  26 |     this._validateTypesenseResult(typesenseResult);
  27 |     const responseAdapter = new SearchResponseAdapter(
  28 |       typesenseResult,
01:33
Max
01:33 PM
it breaks the app as soon the results are returned.
And results actually have amount field šŸ¤”
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:59 PM
Can you check the actual search query being sent?
James
Photo of md5-30d4fe895016bc91ebf1879acf690bab
James
01:59 PM
do you have that field marked as "facet: true"?
Max
Photo of md5-0632b78a36980331a087faf672610530
Max
02:00 PM
Checking...
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:00 PM
This error message happens if your search query has a facet_by=amount but that amount field is not marked as facet: true in the collection schema.
Max
Photo of md5-0632b78a36980331a087faf672610530
Max
02:01 PM
Interesting šŸ¤”
facet_by: "amount"

and it's quite possible that collection don't have item with that field.
Checking dashboard now šŸ˜…
02:03
Max
02:03 PM
Weird though that I don't set it anywhere in the code... šŸ˜…
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:18 PM
You’d have to set ā€œamountā€ as facet: true in the Collection’s schema as well