ES 5.4 在线修改Mapping - 新增字段

curl -X PUT  'http://127.0.0.1:9200/news_info/news_info/_mapping/' -H 'Content-Type:application/json' -d'
{
  "properties": {
       "topic": {
			"store": true,
			"type": "keyword"
		},
		"language_txt": {
			"store": true,
			"type": "keyword"
		},
		"summary": {
			"store": true,
			"type": "text"
		},
		"is_dup": {
			"store": true,
			"type": "integer"
		},
		"dup_id": {
			"store": true,
			"type": "keyword"
		},
		"is_del": {
			"store": true,
			"type": "integer"
		}
   }
}'

查看es mapping设置:

curl -XGET 'http://127.0.0.1:9200/news_info/_settings?pretty'

根据条件过滤,在聚合:

curl -XGET 'http://127.0.0.1:9200/news_info/_search?pretty' -H 'Content-Type:application/json' -d'
{
"size":0 ,
  "query" : {
    "bool" : {
      "must" : [
        {
          "range" : {
            "pubtime" : {
              "from" : "2021-12-21 00:00:00",
              "to" : "2021-12-28 00:00:00",
              "include_lower" : true,
              "include_upper" : true,
              "boost" : 1.0
            }
          }
        },
        {
          "query_string" : {
            "query" : "XXXX YYY",
            "default_field" : "site",
            "fields" : [ ],
            "use_dis_max" : true,
            "tie_breaker" : 0.0,
            "default_operator" : "or",
            "auto_generate_phrase_queries" : false,
            "max_determinized_states" : 10000,
            "enable_position_increments" : true,
            "fuzziness" : "AUTO",
            "fuzzy_prefix_length" : 0,
            "fuzzy_max_expansions" : 50,
            "phrase_slop" : 0,
            "escape" : false,
            "split_on_whitespace" : true,
            "boost" : 1.0
          }
        }
      ],
      "must_not" : [
        {
          "term" : {
            "is_del" : {
              "value" : "1",
              "boost" : 1.0
            }
          }
        }
      ],
      "disable_coord" : false,
      "adjust_pure_negative" : true,
      "boost" : 1.0
    }
  },
  "aggregations" : {
    "agg_topic" : {
      "terms" : {
        "field" : "topic",
        "size" : 15,
        "min_doc_count" : 1,
        "shard_min_doc_count" : 0,
        "show_term_doc_count_error" : false,
        "order" : {
          "_count" : "desc"
        }
      }
    }
  }
}'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值