在windows os上设置elasticsearch?

时间:2014-03-20 06:37:43

标签: json curl elasticsearch sense curl-commandline

我已经阅读了ES的教程,但无法在我的系统上进行配置。

我安装ES,cURL,JSON视图并且工作正常。我无法为chrome安装sense插件,因为它说它已经移动到奇迹,并且没有链接下载。

我试过了:

curl -X PUT "localhost:9200/test_idx_1x"

创建索引。然后我试了一下:

curl -X PUT "localhost:9200/test_idx_1x/test_mapping_1x/_mapping" -d '{
  "test_mapping_1x": {
    "properties": {
      "my_attachments": {
        "type": "attachment"
      }
    }
  }
}'

投掷NullPointerException

为平面文件运行ES需要做什么,有人可以用简单的步骤指导我吗?

ERROR:

2014-03-20 12:01:02,517][DEBUG][action.admin.indices.mapping.put] [Madelyne Pryor] failed to put mappings on indices [[test_idx_1x]], type [test_mapp
ng_1x]
ava.lang.NullPointerException
       at org.elasticsearch.common.xcontent.XContentFactory.xContent(XContentFactory.java:117)
       at org.elasticsearch.common.xcontent.XContentHelper.convertToMap(XContentHelper.java:113)
       at org.elasticsearch.common.xcontent.XContentHelper.convertToMap(XContentHelper.java:101)
       at org.elasticsearch.index.mapper.DocumentMapperParser.parseCompressed(DocumentMapperParser.java:177)
       at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:387)
       at org.elasticsearch.index.mapper.MapperService.parse(MapperService.java:377)
       at org.elasticsearch.cluster.metadata.MetaDataMappingService$5.execute(MetaDataMappingService.java:540)
       at org.elasticsearch.cluster.service.InternalClusterService$UpdateTask.run(InternalClusterService.java:308)
       at org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor
java:134)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)

2 个答案:

答案 0 :(得分:0)

同时使用您的命令添加标题:

-H "Content-Type: application/json"

如果仍然无法正常工作,请用双引号而不是单引号包装json。例如:

-d "{\"test_mapping_1x\" :\"...\"}"

答案 1 :(得分:0)

尝试从Windows上的Git Bash shell进行映射时出现此错误。

在Windows cmd.exe中本机运行的同一命令工作正常(遗憾)。