zoukankan      html  css  js  c++  java
  • es java api 设置index mapping 报错 mapping source must be pairs of fieldnames and properties definition.

    java.lang.IllegalArgumentException: mapping source must be pairs of fieldnames and properties definition.

    从es官网找到的

    request.mapping("_doc", 
            "{
    " +
            "  "_doc": {
    " +
            "    "properties": {
    " +
            "      "message": {
    " +
            "        "type": "text"
    " +
            "      }
    " +
            "    }
    " +
            "  }
    " +
            "}", 
            XContentType.JSON);
    不生效并报错
    查看源码,发现mapping的第二个参数,要求必须为 %2==0,改为
    request.mapping("_doc", "datetime", "type=date");
    多个参数
    request.mapping("_doc", "datetime", "type=date", "string", "type=text");



  • 相关阅读:
    怎么在myeclipse中怎么集成Tomcat。
    JSP .基础概念
    继承
    封装
    什么是面向对象
    数据排序
    开发的套路
    Javabean规范
    转发和重定向
    md5加密
  • 原文地址:https://www.cnblogs.com/BigWrite/p/11584752.html
Copyright © 2011-2022 走看看