Last active
August 29, 2015 14:01
-
-
Save axeff/bacf3bb2119f7589e612 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//create index videos, type test with mapping | |
curl -XPUT localhost:9200/videos/ -d ' | |
{ | |
"mappings" : { | |
"test" : { | |
"properties" : { | |
"playlists": { | |
"type": "nested", | |
"properties" : { | |
"name" : { | |
"type": "multi_field", | |
"fields" : { | |
"name": {"type" : "string", "index" : "analyzed", "store": "yes"}, | |
"untouched" : {"type" : "string", "index" : "not_analyzed"} | |
} | |
}, | |
"position" : { | |
"type" : "string" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
' | |
//put one entry | |
curl -XPUT 'http://localhost:9200/videos/test/1' -d '{ | |
"playlists" : [ | |
{ | |
"name": "de-classics", | |
"position" : "1" | |
}, | |
{ | |
"name": "at-classics", | |
"position" : "2" | |
} | |
] | |
}' | |
//facet search | |
{ | |
"query": { | |
"match_all": {} | |
}, | |
"facets": { | |
"playlists": { | |
"terms": { | |
"field": "playlists.name", | |
"size": 1000 | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment