Prompt

what is the best way to search embeddings with metadata

Artificial Intelligence / AI Search2 observationsLast seen Oct 25, 2026

Latest observation

Oct 25, 2026OpenAI APIWeb search: off

The best way depends on your scale and filters, but the usual “best practice” is:

1) Store embeddings and metadata together in a vector database

Use a vector store that supports:

  • vector similarity search on embeddings
  • metadata filtering on fields like source, date, user_id, category, etc.

Examples: Pinecone, Weaviate, Milvus, Qdrant, pgvector, Elasticsearch/OpenSearch with vector support.

2) Use metadata as a pre-filter when possible

If you know constraints up front, filter first and then search only within that subset.

Example:

  • “Find similar documents for user 123”
  • “Search only published docs from last 30 days”

This is usually faster and gives cleaner results than searching everything and filtering afterward.

3) Use hybrid retrieval for best quality

Combine:

  • vector similarity for semantic meaning
  • keyword/BM25 for exact terms
  • metadata filters for structured constraints

This is often the best overall approach for search quality.

4) Index metadata fields you filter on often

For performance:

  • keep frequently filtered fields indexed
  • use low-cardinality fields carefully
  • avoid overly complex nested filters unless your DB supports them efficiently

5) Keep metadata small and queryable

Good metadata fields:

  • doc_id
  • tenant_id
  • created_at
  • tags
  • language
  • source
  • author

Avoid storing large blobs in metadata if you need fast filtering.

6) Common query pattern

Typical flow:

  1. embed the user query
  2. apply metadata filters
  3. run nearest-neighbor search
  4. optionally rerank top results

Example conceptually:

{
  "vector": [0.12, 0.98, ...],
  "filter": {
    "tenant_id": "acme",
    "doc_type": "faq",
    "created_at": { "$gte": "2025-01-01" }
  },
  "top_k": 10
}

7) If you’re using a relational DB

If your dataset is smaller or you already use Postgres:

  • store embeddings in pgvector
  • store metadata in normal columns
  • use SQL WHERE clauses for metadata filters plus vector distance search

This is often the simplest and most maintainable option.

Rule of thumb

  • Small/medium scale: Postgres + pgvector + indexed metadata
  • Large scale / high QPS: dedicated vector DB with metadata filtering
  • Best search quality: vector + keyword + metadata filters + reranking

If you want, I can recommend the best setup for your specific stack (e.g. Postgres, Pinecone, Qdrant, Elasticsearch) and use case.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (2 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.