ELK查詢---輿情繫統

easyer發表於2020-10-16

關鍵詞查詢

POST toutiao3_sentiment/_search
{
  "size": 0,
  "query": {
    "bool": {
      "must": [
        {
          "range": {
            "ctime": {
              "from": "2019-10-05 00:00:00",
              "to": "2020-10-11 23:59:59",
              "include_lower": true,
              "include_upper": true,
              "boost": 1
            }
          }
        },
        {
          "query_string": {
            "query": " (彩票 OR 體彩 OR 福彩 OR 體育彩票 OR 福利彩票 OR 博彩 OR 彩民 OR 投注站 OR 網點 OR 站點 OR 開獎) ",
            "fields": [
              "abstract^1.0"
            ],
            "type": "best_fields",
            "default_operator": "and",
            "analyzer": "ik_max_word",
            "max_determinized_states": 10000,
            "enable_position_increments": true,
            "fuzziness": "AUTO",
            "fuzzy_prefix_length": 0,
            "fuzzy_max_expansions": 50,
            "phrase_slop": 0,
            "escape": false,
            "auto_generate_synonyms_phrase_query": true,
            "fuzzy_transpositions": true,
            "boost": 1
          }
        },
        {
          "query_string": {
            "query": " (大樂透 OR 雙色球 OR 排列3 OR 排列5 OR 排列三 OR 排列五 OR 排3 OR 排5 OR 排三 OR 排五 OR 競彩 OR 頂呱刮 OR 足彩 OR 傳統足彩 OR 競彩足球 OR 競彩籃球 OR 任選九 OR 任選9 OR 任九 OR 任9 OR 北京單場) ",
            "fields": [
              "abstract"
            ],
            "type": "phrase",
            "default_operator": "and",
            "max_determinized_states": 10000,
            "enable_position_increments": true,
            "fuzziness": "AUTO",
            "fuzzy_prefix_length": 0,
            "fuzzy_max_expansions": 50,
            "phrase_slop": 0,
            "escape": false,
            "auto_generate_synonyms_phrase_query": true,
            "fuzzy_transpositions": true,
            "boost": 1
          }
        },
    {
          "query_string": {
            "query": " (造假 OR 違規 OR 公安 OR 報案 OR 舉報 OR 查處 OR 開庭 OR 行賄 OR 醜聞 OR 假幣 OR 虛假 OR 盜竊 OR 私分 OR 窩藏 OR 合謀 OR 詐騙 OR 欺詐 OR 犯罪 OR 勾結 OR 調包 OR 賭博 OR 坐莊 OR 黑彩 OR 假幣 OR 內幕 OR 黑幕 OR 停止銷售 OR 非法 OR 賭局 OR 老虎機 OR 騙人) ",
            "fields": [
              "abstract^1.0"
            ],
            "type": "best_fields",
            "default_operator": "and",
            "analyzer": "ik_max_word",
            "max_determinized_states": 10000,
            "enable_position_increments": true,
            "fuzziness": "AUTO",
            "fuzzy_prefix_length": 0,
            "fuzzy_max_expansions": 50,
            "phrase_slop": 0,
            "escape": false,
            "auto_generate_synonyms_phrase_query": true,
            "fuzzy_transpositions": true,
            "boost": 1
          }
        }
      ],
      "adjust_pure_negative": true,
      "boost": 1
    }
  }
}

搜尋調整後語句

POST toutiao3_sentiment/_search
{
  "size": 10,
  "query": {
    "bool": {
      "must": [
        {
          "range": {
            "ctime": {
              "from": "2018-10-05 00:00:00",
              "to": "2020-10-11 23:59:59",
              "include_lower": true,
              "include_upper": true,
              "boost": 1
            }
          }
        },
        {
          "query_string": {
            "query": " (彩票 OR 體彩 OR 福彩 OR 體育彩票 OR 福利彩票 OR 博彩 OR 彩民 OR 投注站 OR 網點 OR 站點 OR 開獎) ",
            "fields": [
              "abstract^1.0"
            ],
            "type": "best_fields",
            "default_operator": "and",
            "analyzer": "ik_max_word",
            "max_determinized_states": 10000,
            "enable_position_increments": true,
            "fuzziness": "AUTO",
            "fuzzy_prefix_length": 0,
            "fuzzy_max_expansions": 50,
            "phrase_slop": 0,
            "escape": false,
            "auto_generate_synonyms_phrase_query": true,
            "fuzzy_transpositions": true,
            "boost": 1
          }
        },

        {
          "query_string": {
            "query": " (造假 OR 違規 OR 公安 OR 報案 OR 舉報 OR 查處 OR 開庭 OR 行賄 OR 醜聞 OR 假幣 OR 虛假 OR 盜竊 OR 私分 OR 窩藏 OR 合謀 OR 詐騙 OR 欺詐 OR 犯罪 OR 勾結 OR 調包 OR 賭博 OR 坐莊 OR 黑彩 OR 假幣 OR 內幕 OR 黑幕 OR 停止銷售 OR 非法 OR 賭局 OR 老虎機 OR 騙人 OR 騙局 OR 機密) ",
            "fields": [
              "abstract^1.0"
            ],
            "type": "best_fields",
            "default_operator": "and",
            "analyzer": "ik_max_word",
            "max_determinized_states": 10000,
            "enable_position_increments": true,
            "fuzziness": "AUTO",
            "fuzzy_prefix_length": 0,
            "fuzzy_max_expansions": 50,
            "phrase_slop": 0,
            "escape": false,
            "auto_generate_synonyms_phrase_query": true,
            "fuzzy_transpositions": true,
            "boost": 1
          }
        }
      ],
      "must_not": [
        {
          "query_string": {
            "default_field": "abstract",
            "query": "牆體彩繪 OR 人體彩繪 OR 牙齒 OR 房價 OR 口腔 OR 體彩吉祥物"
          }
        }
      ],
      "should": [
        {
          "query_string": {
            "query": " (大樂透 OR 雙色球 OR 排列3 OR 排列5 OR 排列三 OR 排列五 OR 排3 OR 排5 OR 排三 OR 排五 OR 競彩 OR 頂呱刮 OR 足彩 OR 傳統足彩 OR 競彩足球 OR 競彩籃球 OR 任選九 OR 任選9 OR 任九 OR 任9 OR 北京單場) ",
            "fields": [
              "abstract"
            ],
            "type": "phrase",
            "default_operator": "and",
            "max_determinized_states": 10000,
            "enable_position_increments": true,
            "fuzziness": "AUTO",
            "fuzzy_prefix_length": 0,
            "fuzzy_max_expansions": 50,
            "phrase_slop": 0,
            "escape": false,
            "auto_generate_synonyms_phrase_query": true,
            "fuzzy_transpositions": true,
            "boost": 1
          }
        }
      ],
      "adjust_pure_negative": true,
      "boost": 1
    }
  }
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章