# Marqo

> Vector search over text and images with embeddings built in

- Category: Retrieval & Knowledge (RAG) / Vector Databases
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/marqo-ai/marqo
- Website: https://www.marqo.ai
- Canonical page: https://ai-tldr.dev/tools/marqo/

## In short

Marqo is an open-source vector search engine. It sits in the Vector Databases category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Python and licensed Apache-2.0. To get started: start the Marqo server with Docker.

## Overview

Marqo is an open-source vector search engine. Unlike a plain vector database, it handles the embedding step for you: you send raw text or images, and Marqo generates the vectors, stores them, and serves semantic search over them. This means you don't have to run a separate model to turn your documents into vectors before indexing.

It runs as a Docker container with an HTTP API and a Python client. You create an index, add documents, and search with a natural-language query. Marqo decides which documents are the closest match by meaning rather than by exact keyword overlap, which makes it a fit for the vector-database category where retrieval quality depends on good embeddings.

Note: the Marqo open-source project is marked as deprecated in its README and no longer receives updates. The company now points new users to its hosted product at marqo.ai. The open-source code remains usable for self-hosted projects, but plan around the lack of ongoing maintenance.

## What it does

- Generates embeddings from text and images at index time, so no separate embedding pipeline is needed
- Runs as a single Docker container that exposes an HTTP API
- Official Python client for creating indexes, adding documents, and searching
- Tensor fields let you choose which document fields are embedded for semantic search
- Returns ranked results by semantic similarity to a natural-language query

## Getting started

Marqo runs as a Docker container and is driven from Python. Start the server, install the client, then index and search a few documents.

1. Start the Marqo server with Docker

   Pull and run the Marqo image. It listens on port 8882.

```bash
docker rm -f marqo
docker pull marqoai/marqo:latest
docker run --name marqo -p 8882:8882 marqoai/marqo:latest
```

2. Install the Python client

   Install the marqo package from PyPI.

```bash
pip install marqo
```

3. Index documents and search

   Connect to the local server, create an index, add documents with tensor_fields set to the field you want embedded, then run a natural-language query.

```python
import marqo

mq = marqo.Client(url='http://localhost:8882')

mq.create_index("my-first-index")

mq.index("my-first-index").add_documents([
    {
        "Title": "The Travels of Marco Polo",
        "Description": "A 13th-century travelogue describing Polo's travels"
    },
    {
        "Title": "Extravehicular Mobility Unit (EMU)",
        "Description": "The EMU is a spacesuit that provides environmental protection, "
                       "mobility, life support, and communications for astronauts",
        "_id": "article_591"
    }],
    tensor_fields=["Description"]
)

results = mq.index("my-first-index").search(
    q="What is the best outfit to wear on the moon?"
)
```

## When to use it

- Semantic search over a document collection without building a separate embedding pipeline
- Image search where queries and stored images are matched by meaning rather than tags
- Adding natural-language retrieval to an app prototype using a single self-hosted container
- Backing a retrieval step for question-answering over your own text data
