Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 6.27 KB | None | 0 0
  1. GET books/_search
  2. {
  3.     "query": {
  4.         "function_score": {
  5.             "functions": [
  6.                 {
  7.                     "field_value_factor": {
  8.                         "field": "popularity",
  9.                         "factor": 1,
  10.                         "modifier": "ln2p",
  11.                         "missing": 1
  12.                     },
  13.                     "weight": 1
  14.                 },
  15.                 {
  16.                     "field_value_factor": {
  17.                         "field": "pageViewsLast30",
  18.                         "factor": 1,
  19.                         "modifier": "ln2p",
  20.                         "missing": 1
  21.                     },
  22.                     "weight": 1
  23.                 }
  24.             ],
  25.             "query": {
  26.                 "bool": {
  27.                     "filter": [
  28.                         {
  29.                             "bool": {
  30.                                 "must": [
  31.                                     {
  32.                                         "term": {
  33.                                             "isActive": {
  34.                                                 "value": true
  35.                                             }
  36.                                         }
  37.                                     }
  38.                                 ]
  39.                             }
  40.                         }
  41.                     ],
  42.                     "should": [
  43.                         {
  44.                             "match": {
  45.                                 "title.keyword": {
  46.                                     "query": "starship troopers",
  47.                                     "boost": 25
  48.                                 }
  49.                             }
  50.                         },
  51.                         {
  52.                             "match": {
  53.                                 "title.text": {
  54.                                     "query": "starship troopers",
  55.                                     "minimum_should_match": "100%"
  56.                                 }
  57.                             }
  58.                         },
  59.                         {
  60.                             "match": {
  61.                                 "title.text": {
  62.                                     "query": "starship troopers",
  63.                                     "analyzer": "stop",
  64.                                     "minimum_should_match": "100%"
  65.                                 }
  66.                             }
  67.                         },
  68.                         {
  69.                             "match": {
  70.                                 "title": {
  71.                                     "query": "starship troopers",
  72.                                     "analyzer": "stop",
  73.                                     "minimum_should_match": "80%"
  74.                                 }
  75.                             }
  76.                         },
  77.                         {
  78.                             "match": {
  79.                                 "title": {
  80.                                     "query": "starship troopers",
  81.                                     "analyzer": "stop",
  82.                                     "minimum_should_match": "-40%"
  83.                                 }
  84.                             }
  85.                         },
  86.                         {
  87.                             "match": {
  88.                                 "title": {
  89.                                     "query": "starship troopers",
  90.                                     "analyzer": "stop"
  91.                                 }
  92.                             }
  93.                         },
  94.                         {
  95.                             "match": {
  96.                                 "url.keyword": {
  97.                                     "query": "\/books\/starship troopers"
  98.                                 }
  99.                             }
  100.                         },
  101.                         {
  102.                             "match": {
  103.                                 "url.keyword": {
  104.                                     "query": "\/books\/starship troopers",
  105.                                     "analyzer": "stop"
  106.                                 }
  107.                             }
  108.                         },
  109.                         {
  110.                             "match": {
  111.                                 "url.keyword": {
  112.                                     "query": "\/books\/starship troopers",
  113.                                     "boost": 25
  114.                                 }
  115.                             }
  116.                         },
  117.                         {
  118.                             "match": {
  119.                                 "url.text": {
  120.                                     "query": "starship troopers",
  121.                                     "analyzer": "stop",
  122.                                     "minimum_should_match": "100%"
  123.                                 }
  124.                             }
  125.                         },
  126.                         {
  127.                             "match": {
  128.                                 "url.text": {
  129.                                     "query": "starship troopers",
  130.                                     "analyzer": "stop",
  131.                                     "minimum_should_match": "80%"
  132.                                 }
  133.                             }
  134.                         },
  135.                         {
  136.                             "match": {
  137.                                 "url.keyword": {
  138.                                     "query": "\/books\/starship troopers"
  139.                                 }
  140.                             }
  141.                         },
  142.                         {
  143.                             "match": {
  144.                                 "author.keyword": {
  145.                                     "query": "starship troopers"
  146.                                 }
  147.                             }
  148.                         },
  149.                         {
  150.                             "match": {
  151.                                 "author.text": {
  152.                                     "query": "starship troopers",
  153.                                     "analyzer": "stop",
  154.                                     "minimum_should_match": "100%"
  155.                                 }
  156.                             }
  157.                         }
  158.                     ]
  159.                 }
  160.             }
  161.         }
  162.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement