public
Created

  • Download Gist
position_offset_gap.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
curl -XDELETE localhost:9200/test-idx
curl -XPUT localhost:9200/test-idx -d '{
"settings" :{
"index": {
"number_of_shards": 1,
"number_of_replicas": 0
}
},
"mappings": {
"doc": {
"properties": {
"zero_gap" : {
"type": "string"
},
"non_zero_gap" : {
"type": "string",
"position_offset_gap": 256
}
}
}
}
}'
echo
curl -XPUT localhost:9200/test-idx/doc/1 -d '{
"zero_gap": ["foo", "bar"],
"non_zero_gap": ["foo", "bar"]
}'
echo
curl -XPOST localhost:9200/test-idx/_refresh
echo
curl "localhost:9200/test-idx/doc/_search?pretty=true" -d '{
"query": {
"match_phrase" : {
"zero_gap" : "foo bar"
}
}
}'
echo
curl "localhost:9200/test-idx/doc/_search?pretty=true" -d '{
"query": {
"match_phrase" : {
"non_zero_gap" : "foo bar"
}
}
}'

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.