passed in either as a path to a yaml file or as a dictionary. The following shows how to obtain the schema from an index and connect to an existing index.# write the schema to a yaml filerds.write_schema("redis_schema.yaml")The schema file for this example should look something like:numeric:- name: age  no_index: false  sortable: falsetext:- name: user  no_index: false  no_stem: false  sortable: false  weight: 1  withsuffixtrie: false- name: job  no_index: false  no_stem: false  sortable: false  weight: 1  withsuffixtrie: false- name: credit_score  no_index: false  no_stem: false  sortable: false  weight: 1  withsuffixtrie: false- name: content  no_index: false  no_stem: false  sortable: false  weight: 1  withsuffixtrie: falsevector:- algorithm: FLAT  block_size: 1000  datatype: FLOAT32  dims: 1536  distance_metric: COSINE  initial_cap: 20000  name: content_vectorNotice, this include all possible fields for the schema. You can remove any fields that you don't need.# now we can connect to our existing index as followsnew_rds = Redis.from_existing_index(    embeddings,    index_name="users",    redis_url="redis://localhost:6379",    schema="redis_schema.yaml")results = new_rds.similarity_search("foo", k=3)print(results[0].metadata)    {'id': 'doc:users:8484c48a032d4c4cbe3cc2ed6845fabb', 'user': 'john', 'job': 'engineer', 'credit_score': 'high', 'age': '18'}# see the schemas are the samenew_rds.schema == rds.schema    TrueCustom Metadata Indexingâ€‹In some cases, you may want to control what fields the metadata maps to. For example, you may want the credit_score field to be a categorical field instead of a text field (which is the default behavior for all string fields). In this case, you can use the index_schema parameter in each of the initialization methods above to specify the schema for the index. Custom index schema can either be passed as a dictionary or as a path to a yaml file.All arguments in the schema have defaults besides the name, so you can specify only
Redis vector database introduction and langchain integration guide.
Redis vector database introduction and langchain integration guide. ->: passed in either as a path to a yaml file or as a dictionary. The following shows how to obtain the schema from an index and connect to an existing index.# write the schema to a yaml filerds.write_schema("redis_schema.yaml")The schema file for this example should look something like:numeric:- name: age  no_index: false  sortable: falsetext:- name: user  no_index: false  no_stem: false  sortable: false  weight: 1  withsuffixtrie: false- name: job  no_index: false  no_stem: false  sortable: false  weight: 1  withsuffixtrie: false- name: credit_score  no_index: false  no_stem: false  sortable: false  weight: 1  withsuffixtrie: false- name: content  no_index: false  no_stem: false  sortable: false  weight: 1  withsuffixtrie: falsevector:- algorithm: FLAT  block_size: 1000  datatype: FLOAT32  dims: 1536  distance_metric: COSINE  initial_cap: 20000  name: content_vectorNotice, this include all possible fields for the schema. You can remove any fields that you don't need.# now we can connect to our existing index as followsnew_rds = Redis.from_existing_index(    embeddings,    index_name="users",    redis_url="redis://localhost:6379",    schema="redis_schema.yaml")results = new_rds.similarity_search("foo", k=3)print(results[0].metadata)    {'id': 'doc:users:8484c48a032d4c4cbe3cc2ed6845fabb', 'user': 'john', 'job': 'engineer', 'credit_score': 'high', 'age': '18'}# see the schemas are the samenew_rds.schema == rds.schema    TrueCustom Metadata Indexingâ€‹In some cases, you may want to control what fields the metadata maps to. For example, you may want the credit_score field to be a categorical field instead of a text field (which is the default behavior for all string fields). In this case, you can use the index_schema parameter in each of the initialization methods above to specify the schema for the index. Custom index schema can either be passed as a dictionary or as a path to a yaml file.All arguments in the schema have defaults besides the name, so you can specify only