def _default_approximate_search_query(
        self,
        query_vector: List[float],
        k: int = 4,
        filters: Optional[Union[Dict, List]] = None,
        vector_field: str = "embedding",
        excluded_source_fields: Optional[List[str]] = None,
    ) -> Dict:
        """For Approximate k-NN Search, this is the default query."""
        query = {
            "size": k,
            "query": {
                "knn": {
                    vector_field: {
                        "vector": query_vector,
                        "k": k,
                    }
                }
            },
        }

        if filters:
            # filter key must be added only when filtering to avoid "filter doesn't support values of type: START_ARRAY" exception
            query["query"]["knn"][vector_field]["filter"] = filters
        if excluded_source_fields:
            query["_source"] = {"exclude": excluded_source_fields}
        return query
For Approximate k-NN Search, this is the default query.
llama-index-integrations/vector_stores/llama-index-vector-stores-opensearch/llama_index/vector_stores/opensearch/base.py