반응형
Recent Posts
Recent Comments
관리 메뉴

개발잡부

[es] filter script 본문

ElasticStack/Elasticsearch

[es] filter script

닉의네임 2022. 11. 30. 13:24
반응형

GET hyper-item/_search
{
  "_source": ["itemNm", "itemNo"], 
  "from": 0,
  "size": 20,
  "timeout": "60s",
  "query": {
    "bool": {
      "filter": [
        {
          "script": {
            "script": {
              "source": "(doc['rsvDocDispYn'].value == 'Y' && doc['itemStoreInfo.rsvSoldOutYn'].value == 'N' ) || (doc['docDispYn'].value == 'Y' && doc['itemStoreInfo.soldOutYn'].value == 'N')",
              "lang": "painless"
            }
          }
        },
        {
          "range": {
            "saleStartDt": {
              "from": null,
              "to": "now/m",
              "include_lower": true,
              "include_upper": true,
              "boost": 1
            }
          }
        },
        {
          "range": {
            "saleEndDt": {
              "from": "now/m",
              "to": null,
              "include_lower": true,
              "include_upper": true,
              "boost": 1
            }
          }
        },

        {
          "terms": {
            "itemStoreInfo.storeId": [
              "163"
            ],
            "boost": 1
          }
        },
        {
          "term": {
            "storeType": {
              "value": "HYPER",
              "boost": 1
            }
          }
        },
        {
          "term": {
            "category.scateCd": {
              "value": "300026",
              "boost": 1
            }
          }
        },

        {
          "bool": {
            "must_not": [
              {
                "term": {
                  "itemNo": {
                    "value": "101729255",
                    "boost": 1
                  }
                }
              }
            ],
            "adjust_pure_negative": true,
            "boost": 1
          }
        }
      ],
      "adjust_pure_negative": true,
      "boost": 1
    }
  },
  "sort": [
    {
      "adultSort": {
        "order": "asc"
      }
    },
    {
      "itemStoreInfo.weight": {
        "order": "desc"
      }
    },
    {
      "itemStoreInfo.buyerCnt": {
        "order": "desc"
      }
    },
    {
      "itemNo": {
        "order": "desc"
      }
    }
  ],
  "track_total_hits": -1
}

반응형

'ElasticStack > Elasticsearch' 카테고리의 다른 글

[es] Edge NGram Test  (0) 2022.12.11
[es] NGram Test  (0) 2022.12.11
[es]성능체크  (0) 2022.11.24
[es] health check  (0) 2022.11.16
[es] Terms Query  (0) 2022.09.27
Comments