Skip to content

Instantly share code, notes, and snippets.

@nik9000
Created August 5, 2015 17:07
Show Gist options
  • Save nik9000/e02b854b67de680759de to your computer and use it in GitHub Desktop.
Save nik9000/e02b854b67de680759de to your computer and use it in GitHub Desktop.
curl -XDELETE 0:9200/test?pretty
curl -XPUT 0:9200/test?pretty -d'{
"mappings" : {
"test": {
"properties": {
"content" : {
"type" : "string",
"analyzer" : "french",
"term_vector" : "with_positions_offsets",
"index_options" : "offsets"
}
}
}
}
}'
if [ ! -e doc.json ]; then
curl https://gist.githubusercontent.com/scharron/684a4fbab85135c203ee/raw/ef3c13b1cbebbec9f5c7841983f12d48379129b9/doc.json > doc.json
fi
curl -XPUT '0:9200/test/test/0?pretty&refresh' -d@doc.json
for highlighter in plain fvh postings; do
curl -XPOST '0:9200/test/_search?pretty' -d'{
"_source": false,
"query": {
"filtered": {
"query": {
"query_string": {
"query": "\"Vlaams Brabant\"",
"fields": [
"content"
]
}
}
}
},
"highlight": {
"fields": {
"content": {
"fragment_size": 100,
"type": "'${highlighter}'"
}
}
}
}'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment