• Elasticsearch:修改fielddata


    GET twitter/_search
    {
      "query": {
        "match": {
          "city": "北京"
        }
      },
      "aggs":{
        "count_city":{
          "terms": {
            "field": "city"
          }
        }
      }
    }

    执行以上操作报错,报错内容如下:

    {
      "error": {
        "root_cause": [
          {
            "type": "illegal_argument_exception",
            "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [city] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."
          }
        ],
        "type": "search_phase_execution_exception",
        "reason": "all shards failed",
        "phase": "query",
        "grouped": true,
        "failed_shards": [
          {
            "shard": 0,
            "index": "twitter",
            "node": "mFpXLptTTLKEMHwOAGFZjg",
            "reason": {
              "type": "illegal_argument_exception",
              "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [city] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."
            }
          }
        ],
        "caused_by": {
          "type": "illegal_argument_exception",
          "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [city] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.",
          "caused_by": {
            "type": "illegal_argument_exception",
            "reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [city] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."
          }
        }
      },
      "status": 400
    }

    修改fielddata

    PUT /twitter/_mapping/
    {
      "properties": {
        "city": { 
          "type": "text",
          "fielddata": true
        }
      }
    }
  • 相关阅读:
    求一个电子书制作的好方法
    解决windows xp系统,报iis提示访问人数过多错误
    DEVELOPER: ODP.NET Instant ODP.NET Deployment
    重新注册Oracle相关库
    ODP.NET调用存储需要使用事务
    ReportViewer在设计报告参数(SetParameter)时线程挂起(hang)
    js 时间
    验证码
    script标签属性用type还是language?
    iScroll框架的修改
  • 原文地址:https://www.cnblogs.com/fat-girl-spring/p/12855938.html
Copyright © 2020-2023  润新知