#community-help

Changing Facet Value of Indexed Collections

TLDR Roshan wanted to alter the facet value of fields after indexing. Kishore Nallan explained the current limitation, suggested pre-creation of collection before syncing. Faceted search is also encountered an unknown issue, Kishore Nallan advised to raise the issue in Github.

Powered by Struct AI
eyes1
Feb 03, 2022 (19 months ago)
Roshan
Photo of md5-34813b759bbed85074c3a458c4a2a053
Roshan
10:05 AM
Hi everyone, how can i change facet value once the collections are indexed? when i run the command provided in readme, it creates schema with facet value false for every fields, i wan to change it to true for some fields?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:05 AM
👋 Hi Roshan. I don't follow you. Do you mean adding a new field as a facet?
Roshan
Photo of md5-34813b759bbed85074c3a458c4a2a053
Roshan
10:06 AM
Kishore Nallan I mean i need to change facet value from false to true to some fields
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:06 AM
Got it, as of now, we don't have a way to alter the schema. You have to recreate the collection and index it. But this feature is prioritized so planning to have it soon.
Roshan
Photo of md5-34813b759bbed85074c3a458c4a2a053
Roshan
10:07 AM
I'm currently using typesense-mongodb cli tool for creating schema and indexing
10:08
Roshan
10:08 AM
How can i enable faceting for some fields
10:08
Roshan
10:08 AM
using cli tool
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:08 AM
You can pre-create the collection before running that tool for syncing.
Roshan
Photo of md5-34813b759bbed85074c3a458c4a2a053
Roshan
10:08 AM
npx typesense-mongodb \
   --mongo-collection=test \
   --mongo-database=test \
   --typesense-collection=typesense-collection \
   --mongo-url= \
   --typesense-url=http://localhost:8108 \
   --typesense-api-key=abc
eyes1
10:09
Roshan
10:09 AM
I'm using this command
10:09
Roshan
10:09 AM
You can pre-create the collection before running that tool for syncing How can i do that ? can you share link for this? Kishore Nallan
10:10
Kishore Nallan
10:10 AM
Just create the collection that way before you start the CLI tool (https://github.com/typesense/typesense-mongodb)
Roshan
Photo of md5-34813b759bbed85074c3a458c4a2a053
Roshan
10:37 AM
ok I created the collection now I want to connect that collection with mongodb data(collection) Kishore Nallan?
10:37
Roshan
10:37 AM
how can i do that?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:38 AM
Just pass the collection name via the --typesense-collection cli argument.
Roshan
Photo of md5-34813b759bbed85074c3a458c4a2a053
Roshan
11:10 AM
If i create a collection and try to use in cli as arguments, it says collection already created.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
11:14 AM
Hmm, that should not be the case. Can you please create an issue on the Github repo with the details, we will take a look.
Roshan
Photo of md5-34813b759bbed85074c3a458c4a2a053
Roshan
11:21 AM
ok