Skip to content

Instantly share code, notes, and snippets.

@tennessine
Forked from anonymous/highlight_query.sh
Created January 3, 2017 03:40
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 tennessine/7aa0a5a37ce2b1d7c56b1aa64e52999a to your computer and use it in GitHub Desktop.
Save tennessine/7aa0a5a37ce2b1d7c56b1aa64e52999a to your computer and use it in GitHub Desktop.
This is a script to reproduce a highlighting issue with the text_phrase_prefix query
#!/bin/sh
curl -XPOST 'http://localhost:9200/example_index/'
curl -XPOST 'http://localhost:9200/example_index/example_type/_mapping?pretty=true' -d \
'{
"example_type": {
"Properties": {
"name": {
"type": "string",
"term_vector": "with_positions_offsets",
"store": true
}
}
}
}'
curl -XPUT 'http://localhost:9200/example_index/example_type/1?pretty=true' -d \
'{
"name": "Multiple Terms Per Name"
}'
curl 'http://localhost:9200/example_index/example_type/_search?pretty=true' -d \
'{
"highlight": {
"fields": {
"name": {}
}
},
"query": {
"text_phrase_prefix": {
"name": "Multi"
}
}
}'
curl 'http://localhost:9200/example_index/example_type/_search?pretty=true' -d \
'{
"highlight": {
"fields": {
"name": {}
}
},
"query": {
"text_phrase_prefix": {
"name": "Multiple Term"
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment