Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
More like this (MLT) query to group/classify photos into albums
GET http://localhost:9200/development-asis-flickr_photos/_search
{
"query": {
"filtered": {
"query": {
"bool": {
"must": [
{
"more_like_this": {
"fields": [
"tags"
],
"ids": [
"12345"
],
"min_term_freq": 1,
"max_query_terms": 500,
"percent_terms_to_match": 0.75
}
},
{
"more_like_this": {
"fields": [
"title"
],
"ids": [
"12345"
],
"min_term_freq": 1,
"max_query_terms": 500,
"percent_terms_to_match": 0.5
}
},
{
"more_like_this": {
"fields": [
"description"
],
"ids": [
"12345"
],
"min_term_freq": 1,
"max_query_terms": 500,
"percent_terms_to_match": 0.8
}
}
]
}
},
"filter": {
"bool": {
"must": [
{
"term": {
"owner": "flickr_user_1@n02"
}
},
{
"term": {
"taken_at": "2012-04-23"
}
}
]
}
}
}
},
"aggregations": {
"scores_histogram": {
"histogram": {
"script": "doc.score",
"interval": 2,
"order": {
"_key": "desc"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.