Elasticsearch-使用分析器创建索引时非法_argument_exception

时间:2019-05-30 14:38:28

标签: elasticsearch elasticsearch-5 elasticsearch-mapping elasticsearch-indices elasticsearch-api

我正在使用Elasticsearch的PHP API和Advanced REST Client(ARC)来测试ES API。当我尝试使用自定义分析器创建新索引时,出现以下错误:

"error": {
"root_cause": [
  {
"type": "illegal_argument_exception",
"reason": "unknown setting [index.body.mappings.applications._all.enabled] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
}
],
"type": "illegal_argument_exception",
"reason": "unknown setting [index.body.mappings.applications._all.enabled] please check that any required plugins are installed, or check the breaking changes documentation for removed settings"
},
"status": 400
}

我尝试删除分析设置,并且索引创建成功。我也尝试过从自定义分析仪中删除过滤器,并重新安装了2次ES。

{
  "index": "ar",
  "body": {
    "settings": {
      "analysis": {
        "analyzer": {
          "spanish": {
            "type": "custom",
            "tokenizer": "standard",
            "filter": [
              "lowercase",
              "asciifolding"
            ]
          }
        },
        "filter": {
          "spanish_stemmer": {
            "type": "stemmer",
            "language": "light_spanish"
          },
          "spanish_stop": {
            "type": "stop",
            "stopwords": "_spanish_"
          }
        }
      }
    },
    "mappings": {
      "people": {
        "_all": {
          "enabled": "true"
        },
        "properties": {
          "email": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "url": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "created_at": {
            "type": "date"
          },
          "avatar64": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "description": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "first_name": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "last_name": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "nickname": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "phone": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "state": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "phone2": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "country": {
            "type": "integer"
          },
          "headline": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "location": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "slug_url": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "zip_code": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "modified_at": {
            "type": "date"
          }
        }
      },
      "applications": {
        "_all": {
          "enabled": "true"
        },
        "_parent": {
          "type": "people"
        },
        "properties": {
          "applicant_name": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "applied_at": {
            "type": "date"
          },
          "email": {
            "type": "keyword",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "job_id": {
            "type": "integer"
          },
          "message": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "status": {
            "type": "boolean"
          }
        }
      },
      "resume_details": {
        "_all": {
          "enabled": "true"
        },
        "_parent": {
          "type": "people"
        },
        "properties": {
          "type": {
            "type": "integer"
          },
          "title": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "grantor": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          },
          "message": {
            "type": "text",
            "analyzer": "spanish",
            "search_analyzer": "spanish"
          }
        }
      }
    }
  }
}

必须使用该分析器创建索引

非常感谢!

1 个答案:

答案 0 :(得分:0)

正确:

template<typename Matrix>
void printMatrix(const Matrix& m, std::ostream& out = std::cout)
{
    for (size_t i = 0; i < m.height(); i++) {
        for (size_t j = 0; j < m.width(); j++) {
            out << m[i][j];
        }
        out << std::endl;
    }
}

不正确:

"_all": {
      "enabled": true
    }