# Index legal documents for hybrid search with Qdrant and OpenAI: n8n workflow

> Started by an event in a connected app. It calls services over plain HTTP rather than through connectors.

Source: https://millionrounds.com/workflow/index-legal-documents-for-hybrid-search-with-qdrant-and-open (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Documents and files](https://millionrounds.com/workflows?category=Documents+and+files#library)

# Index legal documents for hybrid search with Qdrant and OpenAI

Started by an event in a connected app. It calls services over plain HTTP rather than through connectors. 30 steps, 2 branches, 2 loops or waits: large, and worth reading before you trust it with anything live.

Large

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Findex-legal-documents-for-hybrid-search-with-qdrant-and-open)

**30 steps** Large: read it before trusting it with anything live

**2** Branches: places the flow splits

**2** Loops or waits

**0** Services by connector: it calls them over plain HTTP

## The flow

Starts it 1 Logic 18 Service 11

The steps in the order they run, from what starts it.

- 1 **Index Dataset from HuggingFace** Manual trigger *Starts it*
- 2 **Check Collection Exists1** Qdrant *Service*
- 3 **Get Dataset Splits** Http Request *Service*
- 4 **Check Collection Exists** Qdrant *Service*
- 5 **If1** If *Logic*
- 6 **Split Them All Out** Split Out *Logic*
- 7 **If** If *Logic*
- 8 **Create Collection1** Qdrant *Service*
- 9 **Get Dataset Rows (Pagination)** Http Request *Service*
- 10 **Create Collection** Qdrant *Service*
- 11 **Divide Per Row** Split Out *Logic*
- 12 **Restructure for Deduplicating** Set *Logic*
- 13 **Deduplicate Texts** Summarize *Service*
- 14 **Restructure for Batching** Set *Logic*
- 15 **Limit** Limit *Logic*
- 16 **Merge** Merge *Logic*
- 17 **Calculate #words in Each Text** Set *Logic*
- 18 **Loop Over Batches** Split In Batches *Logic*
- 19 **Loop Over Batches1** Split In Batches *Logic*
- 20 **Sum them Up** Summarize *Service*
- 21 **Aggregate a Batch** Aggregate *Logic*
- 22 **Edit Fields** Set *Logic*
- 23 **Merge1** Merge *Logic*
- 24 **Aggregate a Batch to Embed** Aggregate *Logic*
- 25 **Get the Average Text Length** Set *Logic*
- 26 **Upsert Points** Qdrant *Service*
- 27 **Aggregate a Batch to Upsert** Aggregate *Logic*
- 28 **Get OpenAI embeddings** Http Request *Service*
- 29 **Upsert Points1** Qdrant *Service*
- 30 **Split Out** Split Out *Logic*

## How it's built

- **Starts on:** An event in a connected app
- **Steps:** 30, with 2 branches, 2 loops or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Nothing by connector; it calls services over plain HTTP
- **Model:** None. This is plumbing, not judgement

## Questions

What does it need to run?

An n8n account. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an event in a connected app.

Does it use AI?

No. Every step is fixed logic or a call to a service, so it does the same thing every time.

How long does it take to set up?

Take your time. At 30 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 30 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Findex-legal-documents-for-hybrid-search-with-qdrant-and-open)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Workflows like it

Also documents and files, with the same services where possible, closest in size first.

- [**Chat with Google Drive and Pinecone** 30 steps · calls a model · Gmail, Google Drive](https://millionrounds.com/workflow/chat-with-google-drive-and-pinecone)
- [**Create custom PDF documents from templates with Gemini** 30 steps · calls a model · Google Drive](https://millionrounds.com/workflow/create-custom-pdf-documents-from-templates-with-gemini)
- [**Automate commercial insurance submissions with Google Suite** 29 steps · Email, Google Docs](https://millionrounds.com/workflow/automate-commercial-insurance-submissions-with-google-suite)
- [**Auto-like tweets from selected profiles with Phantombuster** 29 steps · calls a model](https://millionrounds.com/workflow/auto-like-tweets-from-selected-profiles-with-phantombuster)
- [**Automated Instagram commenting on selected profiles** 31 steps · calls a model](https://millionrounds.com/workflow/automated-instagram-commenting-on-selected-profiles)
- [**Build a PDF Document RAG System with Mistral and Qdrant** 29 steps · calls a model · Google Drive, Qdrant](https://millionrounds.com/workflow/build-a-pdf-document-rag-system-with-mistral-and-qdrant)
