Elasticsearch错误:解析后根类型映射不为空!剩下的字段

时间:2015-06-12 13:31:17

标签: elasticsearch

我正在尝试插入一个新类型的地方'在elasticsearch中使用它的curl API。但它一直都在失败。 我使用的命令是:

function adjustStyle(width) {
    width = parseInt(width);
    if (width < 940) {
        $('#layerslider').layerSlider({
                  slidedelay: '7000',
                  showCircleTimer: false,
                  skin: 'v5',
                  navPrevNext: true,
                  hoverPrevNext: false,
                  navStartStop: true,
                  navButtons: true,
                  thumbnailNavigation: 'disabled',
                  autoStart: true,
                  autoPlayVideos: false,
                  sliderFadeInDuration: '0',
                  layersContainer:'940',
                  responsive: false,
                  responsiveUnder:'1336'
                });
    } else {
        $('#layerslider').layerSlider({
                  slidedelay: '7000',
                  showCircleTimer: false,
                  skin: 'v5',
                  navPrevNext: true,
                  hoverPrevNext: false,
                  navStartStop: true,
                  navButtons: true,
                  thumbnailNavigation: 'disabled',
                  autoStart: true,
                  autoPlayVideos: false,
                  sliderFadeInDuration: '0',
                  layersContainer:'940',
                  responsive: false,
                  responsiveUnder:'940'
                });
    }
}

$(function() {
    adjustStyle($(this).width());
    $(window).resize(function() {
        adjustStyle($(this).width());
    });
});

我收到以下错误:

curl -XPUT host/my_index/_mapping/place --data
'{
    "place": {
        "_id": {
            "path": "place_id"
        },
        "properties": {
            "place_id":{
                "type": "string",
                "index": "not_analyzed",
                "store": true
            },
            "location": {
                "type": "geo_point",
                "store": true
            },
            "name": {
                "type": "string",
                "store": true
            },
            "address": {
                "type": "string",
                "store": true
            },
            "city": {
                "type": "string",
                "store": true
            },
            "state": {
                "type": "string",
                "store": true
            },
            "postal_code": {
                "type": "string",
                "store": true
            },
            "phone": {
                "type": "string",
                "analyzer": "phone_number",
                "store": true
            },
            "update_time": {
                "format": "dateOptionalTime",
                "type": "date"
            }
        }
    }
}'

我没有看错......问题是什么?

感谢您的帮助!

更新

这是索引的当前映射

{"error":"MapperParsingException[Root type mapping not empty after parsing! Remaining fields:   [place : {_id={path=place_id}, properties={place_id={type=string, index=not_analyzed, store=true}, location={type=geo_point, store=true}, name={type=string, store=true}, address={type=string, store=true}, city={type=string, store=true}, state={type=string, store=true}, postal_code={type=string, store=true}, phone={type=string, analyzer=phone_number, store=true}, update_time={format=dateOptionalTime, type=date}}}]]","status":400}% 

1 个答案:

答案 0 :(得分:0)

这可能就像删除第一行和第二行之间的换行符一样简单:

由此:

curl -XPUT host/my_index/_mapping/place --data
'{

对此:

curl -XPUT host/my_index/_mapping/place --data '{

我复制/粘贴了您上面的确切命令,但对我来说失败了。然后我删除了换行符并且它有效。