Skip to content

Instantly share code, notes, and snippets.

@martijnvg
Created January 3, 2013 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martijnvg/4444187 to your computer and use it in GitHub Desktop.
Save martijnvg/4444187 to your computer and use it in GitHub Desktop.
Fvh highlighting with egde ngram token filter.
curl -XDELETE 'localhost:9200/test'
echo
curl -XPUT 'localhost:9200/test?pretty' -d '{
"mappings" : {
"test" : {
"properties" : {
"text" : {
"type" : "string",
"term_vector" : "with_positions_offsets",
"index_analyzer" : "my_analyzer"
}
}
}
},
"settings" : {
"analysis" : {
"analyzer" : {
"my_analyzer" : {
"tokenizer" : "standard",
"filter" : ["lowercase", "my_edge_ngram"]
}
},
"filter" : {
"my_edge_ngram" : {
"type" : "edge_ngram",
"min_gram" : 3,
"max_gram" : 7
}
}
}
}
}'
echo
curl -XPOST 'localhost:9200/test/test?pretty&refresh' -d '{
"text" : "CouchDB"
}'
echo
curl -XGET 'localhost:9200/test/_search?pretty' -d '{
"query" : {
"match" : {
"text" : "couc"
}
},
"highlight" : {
"fields" : {
"text" : {
}
}
}
}'
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment