ELK查询---舆情系统

关键词查询

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 协议》,转载必须注明作者和本文链接
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!