Created
January 3, 2013 15:13
-
-
Save martijnvg/4444187 to your computer and use it in GitHub Desktop.
Fvh highlighting with egde ngram token filter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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