Welcome to your entry point into Marqo! In this guide, we are going to explore how to utilize this powerful tool, which transcends the typical database capabilities by acting as an end-to-end vector search engine for both text and images.
Step 1: Prerequisites
Before diving into Marqo, ensure you have the following:
- Docker: A containerization platform which is essential to run Marqo. If you don’t have it installed yet, visit the Docker Official website for instructions.
- Memory & Storage: Docker should have at least 8GB of memory and 50GB of storage allocated.
Step 2: Running Marqo
To get Marqo up and running, follow these commands in your terminal:
docker rm -f marqo
docker pull marqoai/marqo:latest
docker run --name marqo -p 8882:8882 marqoai/marqo:latest
Step 3: Installing the Marqo Client
Once your Docker container is running smoothly, install the Marqo client with the following command:
pip install marqo
After installation, you’re now ready to start indexing and searching!
Step 4: Begin Indexing and Searching
Now, let’s look at a simple example:
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", "_id": "article_591"},
{"Title": "Extravehicular Mobility Unit (EMU)", "Description": "The EMU is a spacesuit that provides environmental protection, mobility, life support, and communications for astronauts.", "_id": "article_592"},
])
results = mq.index("my-first-index").search(q="What is the best outfit to wear on the moon?")
This code essentially initializes the Marqo client, creates an index, adds documents about Marco Polo and spacesuits, and then searches for relevant queries. Picture Marqo as a library where each book (document) holds unique information about a specific topic, and you are the librarian organizing and retrieving them by topic.
Understanding the Code: An Analogy
Imagine Marqo as a bakery. Here’s how we can break down its functionality:
- The Client represents the bakery owner who oversees everything.
- The create_index() function is like setting up a new shelf in the bakery, ready to hold a new batch of pastries.
- The add_documents() function is akin to placing freshly baked goods on that shelf. Each pastry (document) has its unique flavor (content).
- Lastly, the search() function is the customer asking the owner for a specific pastry — “What is the best item to buy?” The owner (client) quickly finds the best recommendations based on what’s available on the shelf (the index).
Troubleshooting
If you encounter any issues, check the following:
- If your Marqo container keeps getting killed, ensure that Docker is allocated at least 8GB of memory.
- For any installation issues, ensure you have pip updated by running
pip install --upgrade pip. - Should you experience problems with indexing or searching, double-check your syntax and ensure that your documents have the correct structure.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Conclusion
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.
Ready to Dive Deeper?
Marqo packs many features under its hood, and we are just scratching the surface. Check out more detailed examples in the Marqo documentation or the various integrations available!

