Guys, I'm trying to query a date field like this: ...
# community-help
r
Guys, I'm trying to query a date field like this: birthDate:>=165964833 && birthDate:<=797116833 And I get the error "Error with filter field `birthDate`: Not an int64." Am I missing something here? My field is: { "facet": false, "index": true, "name": "birthDate", "optional": true, "type": "int64" },
j
@Rodrigo Paiva Could you share the full code snippet or curl command for the search request?
r
Hey Json, I just figured, that, for some reason, my application is producing an invalid timestamp. Gonna have a look and get back to you. Thanks!
👍 1
I'm trying to find all records by filter criteria
Copy code
{
  "q": "*",
  "query_by": "name",
  "snippet_threshold": 100,
  "include_fields": "name,username,dateCreated,languages,profiles.2a63de7be9b4.engagementPoints,profiles.2a63de7be9b4.statusText,profiles.2a63de7be9b4.platformObjects,profiles.2a63de7be9b4.publicSettings.favoriteCategories",
  "filter_by": "birthDate:<=165968662,profiles.2a63de7be9b4.publicSettings.acceptRequests:= true,profiles.2a63de7be9b4.communityId:= 95f0d208-24a7-4c3b-bd87-2a63de7be9b4"
}
Still keep having the error with a valid timestamp Error with filter field `birthDate`: Not an int64.
j
I'm assuming you want to AND all the field conditions. If so you want to use
&&
between the field names instead of
,
The current filter string with
,
gets parsed as part of the int field which is why you see the error
So
"filter_by": "birthDate:<=165968662 && profiles.2a63de7be9b4.publicSettings.acceptRequests:= true && profiles.2a63de7be9b4.communityId:= 95f0d208-24a7-4c3b-bd87-2a63de7be9b4"
r
oh, so && is also valid for different fields? I was in doubt because the docs are not clear about it, I thought I'd use && only for the same field
1
Will try it like this, thanks!
j
This is documented under "Multiple Conditions:" in the
filter_by
row here: https://typesense.org/docs/0.22.2/api/documents.html#query-parameters Let me know if we can expand the description in a better way
r
oh, indeed! I think I missed the first example num_employees:>100 && country: [USA, UK] Thanks again
👍 1
it worked like a charm 🙌
🙌 1