у меня работает
$ go version
go version go1.11.6 linux/amd64
$ go get -u github.com/blevesearch/bleve/...
$ sh test-bleve-search.sh
+ set -e
+ cat
+ rm -fr test.bleve
+ bleve create ./test.bleve --mapping ./mapping.json
+ cat
+ bleve index test.bleve test.json
Indexing: test
+ bleve query test.bleve location.state:IN
1 matches, showing 1 through 1, took 173.341µs
1. test (0.306853)
location.state
IN
с фиксированным скриптом
#!/bin/sh
set -x
set -e
# create a custom mapping
cat > mapping.json << MAPPING
{
"types": {
"_default": {
"properties": {
"location": {
"properties": {
"state": {
"fields": [
{
"name": "state",
"type": "text",
"analyzer": "keyword",
"store": true,
"index": true,
"include_term_vectors": true,
"include_in_all": true
}
]
}
}
}
}
}
}
}
MAPPING
rm -fr test.bleve
# create index
bleve create ./test.bleve --mapping ./mapping.json
# create JSON file to index
cat > test.json <<DELIM
{
"name": "test",
"location": {
"address1": "777 TEST ROAD",
"address2": "",
"city": "HIGHLAND HEIGHTS",
"state": "IN",
"zip": "777777",
"countryCode": "",
"latitude": 41.549536,
"longitude": -81.454717
}
}
DELIM
# index test file
bleve index test.bleve test.json
# query for the file we indexed
bleve query test.bleve location.state:IN