Skip to content

Instantly share code, notes, and snippets.

@arey
Created November 12, 2013 19:11
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 arey/7436893 to your computer and use it in GitHub Desktop.
Save arey/7436893 to your computer and use it in GitHub Desktop.
Full text search example on the MusicBrainz Elasticsearch index created by the batch provided in the https://github.com/arey/musicbrainz-elasticsearch repository.
curl -XPOST 'http://es.javaetmoi.com/musicalbum/album/_search?pretty' -d '
{
"from": 0,
"size": 10,
"query": {
"bool": {
"must": [
{
"fuzzy_like_this": {
"fields": [
"name",
"artist.name",
"year.string"
],
"like_text": "U2 war",
"min_similarity": 0.7,
"prefix_length": 1
}
}
]
}
},
"facets": {
"artist_type": {
"terms": {
"field": "artist.type_id"
}
},
"album_rating": {
"histogram": {
"key_field": "rating.score",
"interval": 20
}
},
"album_year": {
"range": {
"field": "year",
"ranges": [
{ "to": 1970},
{ "from": 1970, "to": 1980},
{ "from": 1980, "to": 1990},
{ "from": 1990, "to": 2000},
{ "from": 2000, "to": 2010},
{ "from": 2010 }
]
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment