Kibana创建Mapping传送门——json下载包和操作步骤

Kibana创建Mapping:

这个是官方下载测试数据json包的地址

https://www.elastic.co/guide/en/kibana/6.x/tutorial-load-dataset.html

下载测试数据:莎士比亚,账户,日志

正确导入图:

操作步骤中文版:https://blog.csdn.net/ming_311/article/details/50619859

 

这里记录一些问题:

输入bulk apide 时候,现在json目录下,运行shell,然后输入命令:

curl -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary  @accounts.json

会报错:

elasticsearch6.x {"error":"Content-Type header [application/x-www-form-urlencoded] is not supported"

这时候发现是缺少前面的-H "Content-Type: application/json" 

补上即可

https://blog.csdn.net/dtiove/article/details/78870607

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,我可以帮你回答这个问题。 使用Java客户端创建索引和映射,需要连接Elasticsearch服务器,并使用Elasticsearch Java API进行操作。以下是一个简单的示例代码,用于创建索引和映射: ```java import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.common.xcontent.json.JsonXContent; import java.io.IOException; public class ElasticSearchIndexAndMapping { private static final String INDEX_NAME = "example_index"; private static final String TYPE_NAME = "example_type"; public static void main(String[] args) throws IOException { RestHighLevelClient client = new RestHighLevelClient(/* your Elasticsearch client configuration */); // Create index request CreateIndexRequest request = new CreateIndexRequest(INDEX_NAME); // Create index mapping XContentBuilder builder = XContentFactory.jsonBuilder(); builder.startObject(); { builder.startObject("properties"); { builder.startObject("field1"); { builder.field("type", "text"); } builder.endObject(); } builder.endObject(); } builder.endObject(); // Put mapping request PutMappingRequest mappingRequest = new PutMappingRequest(INDEX_NAME); mappingRequest.type(TYPE_NAME); mappingRequest.source(builder); // Execute requests client.indices().create(request, RequestOptions.DEFAULT); client.indices().putMapping(mappingRequest, RequestOptions.DEFAULT); client.close(); } } ``` 在此示例中,我们使用了 `CreateIndexRequest` 和 `PutMappingRequest` 类来创建索引和映射。我们首先创建了一个名为 `example_index` 的索引,并指定了一个名为 `example_type` 的类型。然后,我们使用 `XContentBuilder` 来构建映射。在此示例中,我们只创建了一个名为 `field1` 的字段,并将其类型设置为 `text`。最后,我们使用 `RestHighLevelClient` 来执行创建索引和映射的请求。 请注意,以上示例仅表示如何创建索引和映射。如果您需要更详细的功能,例如添加文档或查询索引,请查看Elasticsearch Java API文档。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值