# No such prop with name 'title' found in class 'Test' in the schema" when querying Weaviate with near\_vector

**URL:** https://forum.weaviate.io/t/no-such-prop-with-name-title-found-in-class-test-in-the-schema-when-querying-weaviate-with-near-vector/7498
**Category:** Support
**Tags:** documentation, developer-experience, technical
**Created:** [November 8, 2024, 7:02am UTC](https://forum.weaviate.io/t/no-such-prop-with-name-title-found-in-class-test-in-the-schema-when-querying-weaviate-with-near-vector/7498 "2024-11-08T07:02:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Sandip](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@Sandip](https://forum.weaviate.io/u/Sandip)
#### Post date: [November 8, 2024, 7:02am UTC](https://forum.weaviate.io/t/no-such-prop-with-name-title-found-in-class-test-in-the-schema-when-querying-weaviate-with-near-vector/7498/1 "2024-11-08T07:02:03Z")

</div>

I’m trying to index and search articles in Weaviate, but I’m encountering an error when querying with `near_vector`. Here’s my process:

1. **Indexing** : I successfully index articles in the “Test” class, with each article having an `article_id`, `title`, and `body`. The vectors are correctly linked based on `article_id`.

```auto
{
  "class_name": "test",
  "data": [
    { "article_id": "0", "title": "title0", "body": "body0" },
    { "article_id": "1", "title": "title1", "body": "body1" },
    ...
  ],
  "vectors": {
    "0": [3.7, 1.4, 4.9, 2.1, 5.6, 7.2, 8.3, 6.5],
    ...
  }
}

```

1. **Search** : When I query with `near_vector` to retrieve `title` and `distance`, I get the following error:

```auto
   raise ValueError(f"An error occurred while performing weaviate search : {e}")
ValueError: An error occurred while performing weaviate search : Query call with protocol GRPC search failed with message <AioRpcError of RPC that terminated with:
	status = StatusCode.UNKNOWN
	details = "no such prop with name 'title' found in class 'Test' in the schema. Check your schema files for which properties in this class are available"
	debug_error_string = "UNKNOWN:Error received from peer {created_time:"2024-11-08T12:25:18.79653+05:30", grpc_status:2, grpc_message:"no such prop with name \'title\' found in class \'Test\' in the schema. Check your schema files for which properties in this class are available"}"

```

1. The indexing appears successful, and I see no issues in the schema setup. Why is this property not accessible in the search query?

**Code** :

```auto
response = weaviate_client.collections.get(weaviate_class_name).query.near_vector(
    near_vector=embedding,
    limit=20,
    return_metadata=MetadataQuery(distance=True),
    return_properties=['title']
)

```

Any suggestions? Thank you!

---

<div class="post-metadata">

### Author: ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)
#### Post date: [November 8, 2024, 11:23am UTC](https://forum.weaviate.io/t/no-such-prop-with-name-title-found-in-class-test-in-the-schema-when-querying-weaviate-with-near-vector/7498/2 "2024-11-08T11:23:45Z")

</div>

hi!!

Can you share a reproducible code?

If possible, with the same code you are using to create the collection, some code similar to what you use to index.

Also, please, always provide the requested information, such as server version, client version, etc.

Thanks!

---

<div class="post-metadata">

### Author: ![Sandip](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@Sandip](https://forum.weaviate.io/u/Sandip)
#### Post date: [November 10, 2024, 6:05am UTC](https://forum.weaviate.io/t/no-such-prop-with-name-title-found-in-class-test-in-the-schema-when-querying-weaviate-with-near-vector/7498/3 "2024-11-10T06:05:49Z")

</div>

```auto
def batch_upload(
        client: weaviate.WeaviateClient,
        weaviate_class: str,
        content: List[Dict],
        vectors: Dict,
        batch_size: int,
        id_field: str
):
    indexed_article = 0

    collection = client.collections.get(weaviate_class)

    with collection.batch.dynamic() as batch:
        batch.batch_size = batch_size
        for article in content:
            batch.add_object(
                references=article,
                vector=vectors[f"{article[id_field]}"]
            )
            indexed_article += 1

    return indexed_article

def create_index(index_name: str, weaviate_client: weaviate.WeaviateClient):
    try:
        weaviate_client.collections.create(name=index_name)
    except Exception as e:
        raise ValueError(f"An error occurred when creating a weaviate class : {e}")

def check_index_exist(index_name: str, client: weaviate.WeaviateClient) -> bool:
    return client.collections.exists(name=index_name)

def index_data_weaviate(
        weaviate_client: weaviate.WeaviateClient,
        index_name: str,
        content: List[Dict[str, Any]],
        vectors: Dict[str, list[float]],
        id_field: str = 'article_id'
) -> int:
    batch_size = 50
    if check_index_exist(index_name, weaviate_client):
        delete_index(index_name, weaviate_client)

    create_index(index_name, weaviate_client)

    indexed_articles = batch_upload(
        weaviate_client,
        index_name,
        content,
        vectors,
        batch_size,
        id_field
    )
    print(f"Total documents indexed : {indexed_articles}")
    return indexed_articles

```

I use above code to index the data.  
I use `index_data_weaviate` function for indexing the data.

Also I use following data for indexing:

```auto
{
  "class_name": "test",
  "data": [
    {
      "article_id": "0",
      "title": "title0",
      "body": "body0"
    },
    {
      "article_id": "1",
      "title": "title1",
      "body": "body1"
    }
  ],
  "vectors": {
    "0": [3.7, 1.4, 4.9, 2.1, 5.6, 7.2, 8.3, 6.5],
    "1": [8.1, 3.6, 7.0, 0.9, 6.8, 1.3, 4.4, 5.2]
  }
}

```

Weaviate image version I use is : `weaviate:1.25.11`,  
And weaviate client version is : `weaviate-client-4.9.3`

---

<div class="post-metadata">

### Author: ![Sandip](https://avatars.discourse-cdn.com/v4/letter/s/ecae2f/32.png) [@Sandip](https://forum.weaviate.io/u/Sandip)
#### Post date: [November 10, 2024, 7:15am UTC](https://forum.weaviate.io/t/no-such-prop-with-name-title-found-in-class-test-in-the-schema-when-querying-weaviate-with-near-vector/7498/4 "2024-11-10T07:15:54Z")

</div>

Issue is all resolved. I was doing it all incorrectly.

1. I changed the index creation code. Earlier property data types was not mentioned in my code.

```auto
def create_index(index_name: str, weaviate_client: weaviate.WeaviateClient):
    try:
        weaviate_client.collections.create(
            name=index_name,
            vectorizer_config=wvc.config.Configure.Vectorizer.none(),
            properties=[
                wvc.config.Property(name='article_id', data_type=wvc.config.DataType.TEXT),
                wvc.config.Property(name='title', data_type=wvc.config.DataType.TEXT),
                wvc.config.Property(name='body', data_type=wvc.config.DataType.TEXT)
            ]
        )
    except Exception as e:
        raise ValueError(f"An error occurred when creating a weaviate class : {e}")

```

1. In the batch upload part I was giving reference to as article, which was incorrect. And In the properties part I am actually passing dictionary with property name and value. Following is the working code:

```auto
def batch_upload(
        client: weaviate.WeaviateClient,
        weaviate_class: str,
        content: List[Dict],
        vectors: Dict,
        batch_size: int,
        id_field: str
):
    indexed_article = 0

    collection = client.collections.get(weaviate_class)

    with collection.batch.dynamic() as batch:
        batch.batch_size = batch_size
        for article in content:
            batch.add_object(
                vector=vectors[f"{article[id_field]}"],
                properties={
                    "article_id": article["article_id"],
                    "title": article["title"],
                    "body": article["body"]
                }
            )
            indexed_article += 1

    return indexed_article

```

1. And finally the vector search code:

```auto
def weaviate_vector_search(
        weaviate_client: weaviate.WeaviateClient,
        weaviate_class_name: str,
        k,
        embedding,
):
    try:
        response = weaviate_client.collections.get(weaviate_class_name).query.near_vector(
            near_vector=embedding,
            limit=20,
            return_metadata=MetadataQuery(distance=True),
            return_properties=['article_id']
        )
    except Exception as e:
        raise ValueError(f"An error occurred while performing weaviate search : {e}")

    for o in response.objects:
        print(o.properties)
        print(o.metadata.distance)

```

Thanks @ [DudaNogueira](https://forum.weaviate.io/u/DudaNogueira) for your quick attention. We can mark this as resolved.

---

<div class="post-metadata">

### Author: ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)
#### Post date: [November 10, 2024, 11:13am UTC](https://forum.weaviate.io/t/no-such-prop-with-name-title-found-in-class-test-in-the-schema-when-querying-weaviate-with-near-vector/7498/5 "2024-11-10T11:13:19Z")

</div>

Hi @Sandip !!

Thanks for sharing!

If you have an article id for each object, you may as well use [deterministic ids](https://weaviate.io/developers/weaviate/manage-data/create#generate-deterministic-ids).

Something like:

```python
from weaviate.util import generate_uuid5
            ...
            batch.add_object(
                uuid=generate_uuid5(article["article_id"]),
                vector=vectors[f"{article[id_field]}"],
                properties={
                    "article_id": article["article_id"],
                    "title": article["title"],
                    "body": article["body"]
                }
            )
            ...

```

Now your batch\_upload can be used to both create and update an object 😉

Happy building!
