Facebook
From Commodious Sheep, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 67
  1. curl --location --request GET 'http://192.168.36.90/search/epa/main/_search' \
  2. --header 'Content-Type: application/json' \
  3. --data-raw '{
  4.     "from": 0,
  5.     "size": 24,
  6.     "query": {
  7.         "function_score": {
  8.             "boost_mode": "replace",
  9.             "functions": [
  10.                 {
  11.                     "script_score": {
  12.                         "params": {
  13.                             "factor": 1.1,
  14.                             "now": 1596725731
  15.                         },
  16.                         "script": [
  17.                             "factor * (1 + (10-log(1 + 0.00024 * abs(now - doc['\''__updated_at'\''].value))))"
  18.                         ]
  19.                     }
  20.                 },
  21.                 {
  22.                     "script_score": {
  23.                         "params": {
  24.                             "factor": 1.2
  25.                         },
  26.                         "script": [
  27.                             "factor * log(1 + 0.06 * doc['\''price'\''].value)"
  28.                         ]
  29.                     }
  30.                 },
  31.                 {
  32.                     "script_score": {
  33.                         "params": {
  34.                             "factor": 1.05
  35.                         },
  36.                         "script": [
  37.                             "factor * (10 - log(1 + 37 * doc['\''ship_price'\''].value))"
  38.                         ]
  39.                     }
  40.                 },
  41.                 {
  42.                     "script_score": {
  43.                         "params": {
  44.                             "factor": 1.2
  45.                         },
  46.                         "script": [
  47.                             "factor * log(1 + 25 * doc['\''sell_count'\''].value)"
  48.                         ]
  49.                     }
  50.                 },
  51.                 {
  52.                     "script_score": {
  53.                         "params": {
  54.                             "factor": 1.2
  55.                         },
  56.                         "script": [
  57.                             "factor * log(1 + 0.001 * doc['\''stock'\''].value)"
  58.                         ]
  59.                     }
  60.                 },
  61.                 {
  62.                     "script_score": {
  63.                         "params": {
  64.                             "factor": 2
  65.                         },
  66.                         "script": [
  67.                             "factor * doc['\''discount'\''].value \/ 10"
  68.                         ]
  69.                     }
  70.                 },
  71.                 {
  72.                     "script_score": {
  73.                         "script": [
  74.                             "-1 * (1000 * sqrt(doc['\''evo_category.id'\''].value))"
  75.                         ]
  76.                     }
  77.                 },
  78.                 {
  79.                     "script_score": {
  80.                         "script": [
  81.                             "_score"
  82.                         ]
  83.                     }
  84.                 }
  85.             ],
  86.             "query": {
  87.                 "filtered": {
  88.                     "filter": {
  89.                         "bool": {
  90.                             "must": [
  91.                                 {
  92.                                     "term": {
  93.                                         "shop_active": true
  94.                                     }
  95.                                 },
  96.                                 {
  97.                                     "term": {
  98.                                         "active": true
  99.                                     }
  100.                                 },
  101.                                 {
  102.                                     "range": {
  103.                                         "price": {
  104.                                             "from": 0.99
  105.                                         }
  106.                                     }
  107.                                 },
  108.                                 {
  109.                                     "range": {
  110.                                         "stock": {
  111.                                             "from": 1
  112.                                         }
  113.                                     }
  114.                                 },
  115.                                 {
  116.                                     "range": {
  117.                                         "evo_category.id": {
  118.                                             "gt": 0
  119.                                         }
  120.                                     }
  121.                                 }
  122.                             ],
  123.                             "must_not": [
  124.                                 {
  125.                                     "term": {
  126.                                         "image_passive": true
  127.                                     }
  128.                                 }
  129.                             ]
  130.                         }
  131.                     },
  132.                     "query": {
  133.                         "bool": {
  134.                             "should": [
  135.                                 {
  136.                                     "match": {
  137.                                         "name": "mayk ayakkabı"
  138.                                     }
  139.                                 }
  140.                             ],
  141.                             "minimum_should_match": "100%"
  142.                         }
  143.                     }
  144.                 }
  145.             },
  146.             "score_mode": "avg"
  147.         }
  148.     },
  149.     "sort": [
  150.         {
  151.             "_score": {
  152.                 "order": "desc"
  153.             }
  154.         }
  155.     ],
  156.     "aggs": {
  157.         "attributes": {
  158.             "aggs": {
  159.                 "attribute_values": {
  160.                     "terms": {
  161.                         "field": "evo_attributes.values.key_value"
  162.                     }
  163.                 }
  164.             },
  165.             "terms": {
  166.                 "field": "evo_attributes.key_value"
  167.             }
  168.         },
  169.         "category": {
  170.             "terms": {
  171.                 "order": {
  172.                     "_term": "asc"
  173.                 },
  174.                 "script": "doc['\''evo_category.breadcrumb_url_text'\''].value + '\''||'\'' + doc['\''evo_category.breadcrumb_text'\''].value",
  175.                 "size": 500
  176.             }
  177.         }
  178.     }
  179. }'