Untitled

mail@pastecode.io avatar
unknown
plain_text
7 days ago
3.3 kB
0
Indexable
Never
{
  "query": {
    "bool": {
      "should": [
        {"match": {"name": {"query": "{{search}}", "boost": 11, "operator": "AND"}}},
        {"match_phrase": {"name": {"query": "{{search}}", "boost": 10, "slop": 14 }}},
        {"match_phrase_prefix": {"name": {"query": "{{search}}", "boost": 9}}},
        {"match": {"other_name": {"query": "{{search}}", "boost": 11, "operator": "AND"}}},
        {"match_phrase": {"other_name": {"query": "{{search}}", "boost": 10, "slop": 14 }}},
        {"match_phrase_prefix": {"other_name": {"query": "{{search}}", "boost": 9}}},
        {"simple_query_string": {"query": "{{search}}", "fields": ["name^10", "other_name^10"], "default_operator": "AND"}},
        { "match": { "categories.name.keyword": "{{search}}" }},
        { "match": { "sku.keyword": "{{search}}" }},
        { "match": { "urlKey.keyword": "{{search}}" }},
        { "match": { "brand.name.keyword": "{{search}}" }},
        { "match": { "brand.url_key.keyword": "{{search}}" }},
        { "match": { "other_categories.keyword": "{{search}}" }},
        { "match": { "other_brand.keyword": "{{search}}" }}
      ],
      "minimum_should_match": 1,
      "filter": {
        "bool": {
          "must": [
            { "terms": { "categories.name.keyword": ["ผลไม้", "น้ำผลไม้ 100%", "น้ำผลไม้ผสม", "น้ำผลไม้และเครื่องดื่มเพื่อสุขภาพ"] } }
          ]
        }
      }
    }
  },
  "size": 10000,
  "rescore": [{
      "window_size": 10000,
      "query": {
        "rescore_query": {
          "bool": {
            "should": [
              {
                "match": {
                  "brand.name": {
                    "query": "LOTUSS",
                    "boost": 8000
                  }
                }
              },
              {
                "match": {
                  "brand.name": {
                    "query": "FOOD GALLERY",
                    "boost": 1000
                  }
                }
              }
            ]
          }
        },
        "query_weight": 1.0,
        "rescore_query_weight": 10
      }
    },{
    "window_size": 10000,
    "query": {
      "rescore_query": {
        "bool": {
          "should": [
            { 
              "match": { 
                "categories.name": {
                  "query": "ผลไม้",
                  "boost": 8000
                }
              }
            },
            {
              "match": {
                "categories.name": {
                  "query": "น้ำผลไม้ 100%",
                  "boost": 2000
                }
              }
            },
            {
              "match": {
                "categories.name": {
                  "query": "น้ำผลไม้ผสม",
                  "boost": 2000
                }
              }
            },
            {
              "match": {
                "categories.name": {
                  "query": "น้ำผลไม้และเครื่องดื่มเพื่อสุขภาพ",
                  "boost": 2000
                }
              }
            }
          ]
        }
      },
      "query_weight": 1.0,
      "rescore_query_weight": 2.0
    }
  }]
}
Leave a Comment