Getting Started

The simplest way to get started with bleve is to use the standard go get operation:

go get

This will build a pure Go version of bleve and install the command-line utility.

Your first bleve program

Create a new package, edit main.go and paste:

package main

import (


func main() {
	// open a new index
	mapping := bleve.NewIndexMapping()
	index, err := bleve.New("example.bleve", mapping)
	if err != nil {

	data := struct {
		Name string
		Name: "text",

	// index some data
	index.Index("id", data)

	// search for some text
	query := bleve.NewMatchQuery("text")
	search := bleve.NewSearchRequest(query)
	searchResults, err := index.Search(search)
	if err != nil {

This should compile, run, and return one search hit for the item added.