# Multi index search, with kNN on one index

**URL:** <https://discuss.elastic.co/t/multi-index-search-with-knn-on-one-index/357040>\
**Category:** Elasticsearch\
**Tags:** vector-search\
**Created:** [April 9, 2024, 8:31am UTC](https://discuss.elastic.co/t/multi-index-search-with-knn-on-one-index/357040 "2024-04-09T08:31:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick\_Dart](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_dart/32/123572_2.png) [@Nick\_Dart](https://discuss.elastic.co/u/Nick_Dart)\
**Post date:** [April 9, 2024, 8:31am UTC](https://discuss.elastic.co/t/multi-index-search-with-knn-on-one-index/357040/1 "2024-04-09T08:31:26Z")

</div>

I have two indices, one with users and one with user posts. I want to search both indices simultaneously, and rank them. As part of this search, i want to do a kNN search as well as a standard text search. However, the kNN search is only applied to the posts, not to the users. Is this possible? I have tried the following:

```auto
{
    "_source": ["_id", "video_url"],
    "track_total_hits": true,
    "query": {
        "exists":{
            "field": "avg_vector"
        }
    },
    "knn": {
        "field": "frame_vectors.frame_vector",
        "query_vector": [
            0.0159149169921875,
            -0.031982421875,
            0.058349609375,
           ....
        ],
        "num_candidates": 100,
        "filter": [
            {
                "exists": {
                    "field": "avg_vector"
                }
            },
            {
                "exists": {
                    "field": "frame_vectors"
                }
            }
        ]
    }
}

```

but unfortunately getting a list of posts (which match the kNN) and then the user index is erroring:

```auto
"_shards": {
        "total": 16,
        "successful": 15,
        "skipped": 0,
        "failed": 1,
        "failures": [
            {
                "shard": 0,
                "index": "user",
                "node": "RUSE4yhWTgufSSfBLUnVoA",
                "reason": {
                    "type": "query_shard_exception",
                    "reason": "failed to create query: [nested] failed to find nested object under path [frame_vectors]",
                    "index_uuid": "VCQz4HZaRsCBeeQlLFPATw",
                    "index": "user",
                    "caused_by": {
                        "type": "illegal_state_exception",
                        "reason": "[nested] failed to find nested object under path [frame_vectors]"
                    }
                }
            }
        ]
    },

```
