This code:
index_suffix = "data"
index_name = f"vector_{index_suffix}"
keyword_index_name = f"keyword_{index_suffix}"
print(f"Setup with indices: {index_name} and {keyword_index_name} ")
hybrid_db = Neo4jVector.from_documents(
docs,
embeddings,
url=url,
username=username,
password=password,
search_type="hybrid",
pre_delete_collection=True,
index_name=index_name,
keyword_index_name=keyword_index_name,
)
print(f"\nLoaded hybrid_db {hybrid_db.search_type} with indices: {hybrid_db.index_name} and {hybrid_db.keyword_index_name} ")
print(f"Embedded {index_suffix}\nsize of docs: {len(docs)}\n")
prints this, which is not what I expect since I have set the index_name and keyword_name
Setup with indices: vector_data and keyword_data
Loaded hybrid_db hybrid with indices: vector and keyword
Embedded data
size of docs: 543
System Info
System Information
------------------
> OS: Linux
> OS Version: #1 SMP Thu Oct 5 21:02:42 UTC 2023
> Python Version: 3.12.2 (main, Feb 7 2024, 21:49:26) [GCC 10.2.1 20210110]
Package Information
-------------------
> langchain_core: 0.1.26
> langchain: 0.1.9
> langchain_community: 0.0.24
I have executed the code above and I got that output, which is not what I expect.
you can use create_id_index=True in neo4j.from_documents, it says default value is also true but I also faced same problem then tried this then I am able to create new index also consider looking into its documentation from langchain
there are some limitations of Neo4j that you can't have two vector indexes on the same node label and property.so also consider changing value of node_label=