query:
GET /media/_search
{
"explain": false,
"track_total_hits": true,
"profile": false,
"query": {
"function_score": {
"query": {
"bool": {
"must": [],
"must_not": [
{
"terms": {
"opt_contract": [
"editorial"
]
}
},
{
"terms": {
"state": [
"blocked",
"suspend",
"deleted",
"deleted_highres",
"deleted_admin"
]
}
}
],
"should": [
{
"multi_match": {
"query": "hot girl",
"type": "phrase",
"fields": [
"id_media.keyword^30",
"keywords_prio^1",
"title^0.5",
"description^0.5",
"keywords_category^0.3",
"keywords_main^0.3",
"keywords^0.1",
"keywords_bought^0.5"
],
"minimum_should_match": "2<-25%",
"prefix_length": 3,
"auto_generate_synonyms_phrase_query":true
}
},
{
"multi_match": {
"query": "hot girl",
"operator": "and",
"fields": [
"id_media.keyword^30",
"keywords_prio^1",
"title^0.5",
"description^0.5",
"keywords_category^0.3",
"keywords_main^0.3",
"keywords^0.1",
"keywords_bought^0.5"
],
"fuzziness": "AUTO",
"prefix_length": 3
}
},
{
"range": {
"ranking": {
"boost": 6,
"gte": 9
}
}
},
{
"range": {
"ranking": {
"boost": 4,
"gte": 7,
"lt": 9
}
}
},
{
"range": {
"ranking": {
"boost": 2,
"gte": 5,
"lt": 7
}
}
}
],
"filter": [
{
"terms": {
"id_art_collection": [
2,
4,
6
]
}
},
{
"range": {
"ranking": {
"gte": 5
}
}
},
{
"match": {
"published": "SA"
}
},
{
"terms": {
"state": [
"active",
"accepted"
]
}
},
{
"match": {
"date_deleted": "1970\/01\/01 00:00:00"
}
},
{
"terms": {
"opt_contract": [
"rights"
]
}
},
{
"terms": {
"flags": [
"photo"
]
}
}
]
}
},
"functions": [
{
"gauss": {
"date_upload": {
"origin": "now+20d",
"scale": "30d",
"offset": "1d",
"decay": 0.5
}
},
"weight": 6
},
{
"field_value_factor": {
"field": "additional_weight",
"factor": 0.01,
"modifier": "sqrt",
"missing": 0
}
},
{
"field_value_factor": {
"field": "not_adult",
"factor": 5,
"modifier": "sqrt",
"missing": 0
}
},
{
"field_value_factor": {
"field": "sales_total",
"factor": 0.1,
"modifier": "sqrt",
"missing": 0
}
},
{
"field_value_factor": {
"field": "sales_total_last_12M",
"factor": 1,
"modifier": "sqrt",
"missing": 0
}
},
{
"field_value_factor": {
"field": "has_gps",
"factor": 2.5,
"modifier": "sqrt",
"missing": 0
}
},
{
"weight": 2,
"random_score": {
"seed": 1234,
"field": "id_user"
}
},
{
"weight": 2,
"random_score": {
"seed": 1234,
"field": "id_media"
}
}
],
"score_mode": "sum",
"boost_mode": "sum"
}
},
"from": 0,
"size": 60,
"_source": [
"id_media",
"width",
"height",
"id_user",
"keywords_prio",
"title",
"keywords",
"description",
"opt_contract",
"flags",
"id_art_collection",
"has_gps",
"ranking",
"date_upload",
"sales_total_last_12M",
"sales_total",
"additional_weight",
"keywords_category",
"keywords_main",
"keywords_bought"
]
}