Created
November 19, 2013 10:44
-
-
Save ariasdelrio/7543562 to your computer and use it in GitHub Desktop.
Highlighting not working in ES 0.90.6/7
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 -s -X DELETE "http://localhost:9200/test_highlight" > /dev/null | |
curl -s -X PUT "http://localhost:9200/test_highlight" -d ' | |
{ | |
"settings" : { | |
"index": { | |
"number_of_shards" : 1, | |
"analysis": { | |
"analyzer": { | |
"icu_analyzer" : { | |
"type": "custom", | |
"tokenizer": "icu_tokenizer", | |
"filter": ["icu_folding", "edge_ngram"] | |
} | |
} | |
} | |
} | |
} | |
} | |
' > /dev/null | |
curl -s -X PUT "http://localhost:9200/test_highlight/test1/_mapping" -d ' | |
{ | |
"test1": { | |
"properties" : { | |
"myfield" : { "type" : "string", "analyzer" : "icu_analyzer" } | |
} | |
} | |
} | |
' > /dev/null | |
curl -s -X PUT "http://localhost:9200/test_highlight/test1/1" -d ' | |
{ | |
"myfield": "some text to highlight" | |
} | |
' > /dev/null | |
sleep 1 | |
curl -s -X PUT "http://localhost:9200/test_highlight/test2/_mapping" -d ' | |
{ | |
"test2": { | |
"properties" : { | |
"myfield" : { "type" : "string", "analyzer" : "icu_analyzer", "index_options" : "offsets" } | |
} | |
} | |
} | |
' > /dev/null | |
curl -s -X PUT "http://localhost:9200/test_highlight/test2/1" -d ' | |
{ | |
"myfield": "some text to highlight" | |
} | |
' > /dev/null | |
sleep 1 | |
curl -s -X PUT "http://localhost:9200/test_highlight/test3/_mapping" -d ' | |
{ | |
"test3": { | |
"properties" : { | |
"myfield" : { "type" : "string", "analyzer" : "icu_analyzer", "term_vector": "with_positions_offsets" } | |
} | |
} | |
} | |
' | |
curl -s -X PUT "http://localhost:9200/test_highlight/test3/1" -d ' | |
{ | |
"myfield": "some text to highlight" | |
} | |
' > /dev/null | |
sleep 1 | |
echo 'Normal highlighter' | |
curl -s -X POST "http://localhost:9200/test_highlight/test1/_search" -d ' | |
{ | |
"query": { "match": { "myfield": "te" } }, | |
"highlight": { "fields": { "myfield": {} } } | |
} | |
'| python -mjson.tool | |
echo 'Postings highlighter' | |
curl -s -X POST "http://localhost:9200/test_highlight/test2/_search" -d ' | |
{ | |
"query": { "match": { "test2.myfield": "te" } }, | |
"highlight": { "fields": { "myfield": {"type" : "postings"} } } | |
} | |
'| python -mjson.tool | |
echo 'Fast vector highlighter' | |
curl -s -X POST "http://localhost:9200/test_highlight/test3/_search" -d ' | |
{ | |
"query": { "match": { "myfield": "te" } }, | |
"highlight": { "fields": { "myfield": {"type" : "fvh"} } } | |
} | |
'| python -mjson.tool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment