Hi <@U01NZ4D0LDD>, <@U01PL2YSG8L> I am using Types...
# community-help
s
Hi @Jason Bosco, @Kishore Nallan I am using Typesense Multi-tenant functionality where I will create a scope search key for organizations and execute search queries using the scope key. But I have 1 column in the collection that have different key value for each organization. But Typesense collections do not support JSON type. How I fulfilled my requirement that I wanted to search documents based on custom column key value that I stored in one column name as "custom". below I mention an example that I have 2 organizations with document examples: orgA document for candidates collections: { "name": "john minati", "email":"john@gmail.com", "custom":{ "location":"", "address":"" } } orgB document for candidate schema: { "name": "carry minati", "email":"carry@gmail.com", "custom":{ "salary":"", "linkedin":"" } } here my collection name is a candidates and one column value is different for each organization like custom, how do I fulfill my requirement that I wanted to execute a search key for orgA search by location and orgB search by LinkedIn?
k
You could have an
object
field which can contain different keys.
Copy code
curl -k "<http://localhost:8108/collections>" -X POST -H "Content-Type: application/json" \                                                                                                                        
      -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{
        "name": "docs", "enable_nested_fields": true,
        "fields": [
          {"name":"custom","type":"object"}
        ]
      }'
In the example above you can index a sub-field under the custom object and then during querying you just need to mention
query_by=custom
instead of specifying the child fields explicitly. We will search on the child fields on the
custom
object automatically.
s
object type not listed in Typesense doc.
s
Thanks @Kishore Nallan 🙂