WeaviateQueryError when using weaviate.collections.collection.Collection.query.near_text()

Description

Having problems specifically with near_text but only after closing the notebook that created the collection.

Server Setup Information

  • Weaviate Server Version: 1.27.10
  • Deployment Method: working locally on an anaconda enviroment
  • Multi Node? Nope
  • Client Language and Version: python weaviate-client==4.5.5

Any additional Information

I’m exploring in a jupyter notebook. Connected to client in a notebook using the following code:
client = weaviate.connect_to_embedded(
headers={
“X-OpenAI-Api-Key”: openai.api_key # Replace with your API key
},
port = 8078,
version = “latest”
)
then I created a collection called Terapeutas2with named vectors:

from weaviate.classes.config import Configure, Property, DataType

client.collections.create(
    "Terapeutas2",
    properties=[  # properties configuration is optional
        Property(name="therapist_id",
                 data_type=DataType.UUID),
        
        Property(name="nombre",
                 data_type=DataType.TEXT,
                 skip_vectorization=True),
        
        # propiedades de las cuales saldra un vector
        Property(name="especialidades",
                 data_type=DataType.TEXT,
                 skip_vectorization=False),
        Property(name="experiencia",
                 data_type=DataType.TEXT,
                 skip_vectorization=False),
        Property(name="terapias",
                 data_type=DataType.TEXT,
                 skip_vectorization=False),
        Property(name="todo",
                 data_type=DataType.TEXT,
                 skip_vectorization=False),
        Property(name="session_description",
                 data_type=DataType.TEXT,
                 skip_vectorization=False),
        Property(name="poblaciones",
                 data_type=DataType.TEXT,
                 skip_vectorization=False),
        
        # bool
        Property(name="presencial",
                 data_type=DataType.BOOL,
                 skip_vectorization=True),
        Property(name="virtual",
                 data_type=DataType.BOOL,
                 skip_vectorization=True),
        Property(name="individual",
                 data_type=DataType.BOOL,
                 skip_vectorization=True),
        Property(name="familiar",
                 data_type=DataType.BOOL,
                 skip_vectorization=True),
        Property(name="parejas",
                 data_type=DataType.BOOL,
                 skip_vectorization=True),
        
        Property(name="fp_efectivo",
                 data_type=DataType.BOOL),
        Property(name="fp_transferencia",
                 data_type=DataType.BOOL),
        Property(name="fp_TDC",
                 data_type=DataType.BOOL),
        Property(name="fp_paypal",
                 data_type=DataType.BOOL),
        Property(name="fp_AMEX",
                 data_type=DataType.BOOL),
        Property(name="costo_de_acuerdo_a_ingresos",
                 data_type=DataType.BOOL),
        
        
        # int
        Property(name="costo_individual_presencial",
                 data_type=DataType.INT),
        Property(name="costo_pareja_presencial",
                 data_type=DataType.INT),
        Property(name="costo_individual_virtual",
                 data_type=DataType.INT),
        Property(name="costo_pareja_virtual",
                 data_type=DataType.INT),
        
        #categorical
        Property(name="grado",
                 data_type=DataType.TEXT,
                 skip_vectorization=True),
        Property(name="cp",
                 data_type=DataType.TEXT,
                 skip_vectorization=True),
        Property(name="ciudad",
                 data_type=DataType.TEXT,
                 skip_vectorization=True),
        
        #geoLocation and address
        Property(name="location",
                 data_type=DataType.GEO_COORDINATES),
        Property(name="direccion",
                 data_type=DataType.TEXT,
                 skip_vectorization=True),
        Property(name="telefono",
                 data_type=DataType.PHONE_NUMBER),
    ],
    vectorizer_config=[
        # Set a named vector
        Configure.NamedVectors.text2vec_openai(  # Use the "text2vec-cohere" vectorizer
            name="especialidades",
            source_properties=["especialidades"],
            model="text-embedding-3-small",
            vectorize_collection_name=True
        ),
        Configure.NamedVectors.text2vec_openai(  
            name="experiencia",
            source_properties=["experiencia"],         
            model="text-embedding-3-small",
            vectorize_collection_name=True
        ),
        Configure.NamedVectors.text2vec_openai(  
            name="terapias",
            source_properties=["terapias"],        
            model="text-embedding-3-small",
            vectorize_collection_name=True
        ),
        Configure.NamedVectors.text2vec_openai(  
            name="todo",
            source_properties=["todo"],          
            model="text-embedding-3-large", 
            vectorize_collection_name=True
        ),
        Configure.NamedVectors.text2vec_openai(  
            name="session_description",
            source_properties=["session_description"],          
            model="text-embedding-3-large", 
            vectorize_collection_name=True
        ),
        Configure.NamedVectors.text2vec_openai(  
            name="poblaciones",
            source_properties=["poblaciones"],          
            model="text-embedding-3-small", 
            vectorize_collection_name=True
        )
    ],
)

I run :
terapeutas = client.collections.get("Terapeutas2")
and then the following query:

    query = "una terapia novedosa para tratar adicciones",
    target_vector = "todo",
    limit = 5,
    return_metadata = MetadataQuery(certainty = True),
    filters=(
        Filter
        .by_property("location")
        .within_geo_range(
            coordinate=GeoCoordinate(
                latitude=19.057,
                longitude=-99.0345
            ),
            distance=100000  # In meters
        )
        &
        Filter
        .by_property("costo_individual_presencial").less_or_equal(800)
    )    
)```
AND EVERYTHING WORKED FINE! problems came later, when trying to run the same query on a different notebook (same enviroment, same folder!!!)
then I shuted down the notebook, started a new one:
```client = weaviate.connect_to_embedded(
    headers={
        "X-OpenAI-Api-Key": openai.api_key  
    },
    port = 8078,
    version = "latest"
)
terapeutas = client.collections.get("Terapeutas2")
response = terapeutas.query.bm25(
        query="adicciones",
        limit=2
    ) ```
**And the bm25 query works just fine!!!!**
Then I tried:

response = terapeutas.query.near_text(
query = “terapia inovadora”,
target_vector = “terapias”)

And it gives me the following error:
WeaviateQueryError: Query call with protocol GRPC search failed with message explorer: get class: vector search: object vector search at index terapeutas2: shard terapeutas2_NGYXuniVPv9Z: vector search: knn search: distance between entrypoint and query node: got a nil or zero-length vector at docID 105.

Hi @carmendeni ! Welcome to our community!

I believe you have hit this known issue: