This guide shows how to install and run Vespa on a single machine using Docker - it deploys an application, feeds some data and issues queries. See Getting Started for troubleshooting, next steps and other guides.
Prerequisites:
NO_SPACE
- the vespaengine/vespa container image + headroom for data requires disk space.
Read more.
This guide is tested with vespaengine/vespa:8.458.13 container image.
Validate the environment:
$ docker info | grep "Total Memory" or $ podman info | grep "memTotal"
Make sure you see at minimum 4 GB.
Install the Vespa CLI:
Using Homebrew:
$ brew install vespa-cli
You can also download Vespa CLI for Windows, Linux and macOS.
Set local target:
$ vespa config set target local
Start a Vespa Docker container:
$ docker run --detach --name vespa --hostname vespa-container \ --publish 8080:8080 --publish 19071:19071 \ vespaengine/vespa
The port 8080
is published to make the search and feed interfaces
accessible from outside the docker container,
19071 is the config server endpoint.
Only one docker container named vespa
can run at a time so change the name if needed.
See Docker containers for more insights.
Initialize myapp/
to a copy of a
sample
application package:
$ vespa clone album-recommendation myapp && cd myapp
Deploy it:
$ vespa deploy --wait 300
Feed documents:
$ vespa feed ext/documents.jsonl
Issue queries:
$ vespa query "select * from music where album contains 'head'" \ language=en-US
$ vespa query "select * from music where true" \ "ranking=rank_albums" \ "input.query(user_profile)={pop:0.8,rock:0.2,jazz:0.1}"
$ vespa query "select * from music where true" \ "ranking=rank_albums" \ "input.query(user_profile)={pop:0.8,rock:0.2,jazz:0.1}" \ "presentation.format.tensors=short-value"
This uses the Query API. Note that a query's language is a factor when doing text matching, refer to linguistics to learn more.
Get documents:
$ vespa document get id:mynamespace:music::a-head-full-of-dreams
$ vespa visit
Get a document by ID, or export all documents - see /document/v1 and vespa visit.
Check out getting started for more tutorials and use cases which Vespa is great for.
$ docker rm -f vespa