Sign inDemoInstall

Package Overview
File Explorer

Install Socket

Protect your apps from supply chain attacks


Package bleve is a library for indexing and searching text. Example Opening New Index, Indexing Data Example Opening Existing Index, Searching Data


Version published


# ![bleve](docs/bleve.png) bleve

[![Coverage Status](](
[![Join the chat at](](
[![Go Report Card](](

A modern text indexing library in go

## Features

* Index any go data structure (including JSON)
* Intelligent defaults backed up by powerful configuration
* Supported field types:
    * Text, Numeric, Datetime, Boolean
* Supported query types:
    * Term, Phrase, Match, Match Phrase, Prefix, Fuzzy
    * Conjunction, Disjunction, Boolean (must/should/must_not)
    * Term Range, Numeric Range, Date Range
    * [Geo Spatial](
    * Simple [query string syntax]( for human entry
* [tf-idf]( Scoring
* Query time boosting
* Search result match highlighting with document fragments
* Aggregations/faceting support:
    * Terms Facet
    * Numeric Range Facet
    * Date Range Facet

## Indexing

message := struct{
	Id   string
	From string
	Body string
	Id:   "example",
	From: "",
	Body: "bleve indexing is easy",

mapping := bleve.NewIndexMapping()
index, err := bleve.New("example.bleve", mapping)
if err != nil {
index.Index(message.Id, message)

## Querying

index, _ := bleve.Open("example.bleve")
query := bleve.NewQueryStringQuery("bleve")
searchRequest := bleve.NewSearchRequest(query)
searchResult, _ := index.Search(searchRequest)

## Command Line Interface

To install the CLI for the latest release of bleve, run:

$ go install

$ bleve --help
Bleve is a command-line tool to interact with a bleve index.

  bleve [command]

Available Commands:
  bulk        bulk loads from newline delimited JSON files
  check       checks the contents of the index
  count       counts the number documents in the index
  create      creates a new index
  dictionary  prints the term dictionary for the specified field in the index
  dump        dumps the contents of the index
  fields      lists the fields in this index
  help        Help about any command
  index       adds the files to the index
  mapping     prints the mapping used for this index
  query       queries the index
  registry    registry lists the bleve components compiled into this executable
  scorch      command-line tool to interact with a scorch index

  -h, --help   help for bleve

Use "bleve [command] --help" for more information about a command.

## Text Analysis

Bleve includes general-purpose analyzers (customizable) as well as pre-built text analyzers for the following languages:

Arabic (ar), Bulgarian (bg), Catalan (ca), Chinese-Japanese-Korean (cjk), Kurdish (ckb), Danish (da), German (de), Greek (el), English (en), Spanish - Castilian (es), Basque (eu), Persian (fa), Finnish (fi), French (fr), Gaelic (ga), Spanish - Galician (gl), Hindi (hi), Croatian (hr), Hungarian (hu), Armenian (hy), Indonesian (id, in), Italian (it), Dutch (nl), Norwegian (no), Portuguese (pt), Romanian (ro), Russian (ru), Swedish (sv), Turkish (tr)

## Text Analysis Wizard


## Discussion/Issues

Discuss usage/development of bleve and/or report issues here:
* [Github issues](
* [Google group](!forum/bleve)

## License

Apache License Version 2.0


Last updated on 13 Sep 2023

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.


Related posts

SocketSocket SOC 2 Logo


  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc