Skip to content

Instantly share code, notes, and snippets.

@damienalexandre
Created June 11, 2013 15:19
Show Gist options
  • Save damienalexandre/5757742 to your computer and use it in GitHub Desktop.
Save damienalexandre/5757742 to your computer and use it in GitHub Desktop.
Issue 1957
curl -XDELETE 'http://localhost:9200/pony_index_tmp'
curl -XPUT 'http://localhost:9200/pony_index_tmp' -d '
{
"number_of_shards": 1,
"number_of_replicas": 1
}'
curl -XPUT 'http://localhost:9200/pony_index_tmp/label/_mapping' -d '
{
"label": {
"properties": {
"name": {
"type": "multi_field",
"boost": 4,
"fields": {
"name": {
"type": "string",
"boost": 30
},
"untouched": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}'
curl -XPOST "http://localhost:9200/pony_index_tmp/label/1" -d '
{
"name":"Ace of spade"
}
'
curl -XPOST "http://localhost:9200/pony_index_tmp/label/2" -d '
{
"name":"Queens of the stone age"
}
'
curl -XPOST "http://localhost:9200/pony_index_tmp/label/3" -d '
{
"name":"Queen"
}
'
curl -XPOST "http://localhost:9200/pony_index_tmp/label/4" -d '
{
"name":"Gypsy Queens"
}
'
curl -XPOST "http://localhost:9200/pony_index_tmp/label/5" -d '
{
"name":"Gypsy - Queens"
}
'
# on the analyzed field
curl -XGET 'http://localhost:9200/pony_index_tmp/_search?pretty=true' -d '
{
"query": {
"match_all" : { }
},
"facets" : {
"toto" : { "terms" : {"field" : "name"} }
}
}'
# on the NOT analyzed field
curl -XGET 'http://localhost:9200/pony_index_tmp/_search?pretty=true' -d '
{
"query": {
"match_all" : { }
},
"facets" : {
"name" : { "terms" : {"field" : "name.untouched", "size": 12} }
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment