(八)Index and Query a Document
Let’s now put something into our customer index. We’ll index a simple customer document into the customer index, with an ID of 1 as follows:
curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H 'Content-Type: application/json' -d'
{
"name": "John Doe"
}
'
{
"_index" : "customer",
"_type" : "_doc",
"_id" : "",
"_version" : ,
"result" : "created",
"_shards" : {
"total" : ,
"successful" : ,
"failed" :
},
"_seq_no" : ,
"_primary_term" :
}
From the above, we can see that a new customer document was successfully created inside the customer index. The document also has an internal id of 1 which we specified at index time.
curl -X GET "localhost:9200/customer/_doc/1?pretty"
And the response:
{
"_index" : "customer",
"_type" : "_doc",
"_id" : "",
"_version" : ,
"found" : true,
"_source" : { "name": "John Doe" }
}
Nothing out of the ordinary here other than a field, found
, stating that we found a document with the requested ID 1 and another field, _source
, which returns the full JSON document that we indexed from the previous step.
(八)Index and Query a Document的更多相关文章
- Learning Query and Document Similarities from Click-through Bipartite Graph with Metadata
读了一篇paper,MSRA的Wei Wu的一篇<Learning Query and Document Similarities from Click-through Bipartite Gr ...
- Elasticsearch核心技术(2)--- 基本概念(Index、Type、Document、集群、节点、分片及副本、倒排索引)
Elasticsearch核心技术(2)--- 基本概念 这篇博客讲到基本概念包括: Index.Type.Document.集群,节点,分片及副本,倒排索引. 一.Index.Type.Docume ...
- 【ElasticSearch】:索引Index、文档Document、字段Field
因为从ElasticSearch6.X开始,官方准备废弃Type了.对应数据库,对ElasticSearch的理解如下: ElasticSearch 索引Index 文档Document 字段Fiel ...
- 【MonogDB】The description of index(二) Embedded and document Index
In this blog, we will talk about another the index which was called "The embedded ". First ...
- Elasticsearch-->Get Started-->Exploring Your Cluster
Version 直接对localhost:9200发出一个get请求 { "name": "WqeJVip", "cluster_name" ...
- ES Docs-2:Exploring ES cluster
The REST API Now that we have our node (and cluster) up and running, the next step is to understand ...
- Elasticsearch 入门 - Exploring Your Cluster
The REST API Cluster Health ( http://localhost:9200/ ) curl -X GET "localhost:9200/_cat/health? ...
- 2743711 - Possible Unexpected Results When Using Query With an ORDER BY Clause on a Rowstore Table With a Parallelized Search on a Cpbtree-Type Index
2743711 - Possible Unexpected Results When Using Query With an ORDER BY Clause on a Rowstore Table W ...
- ElasticSearh更新nested字段(Array数组)。怎么根据查询条件(query)复制一个(index)到新的Index how to update by query a nested fields data for elasticsearch
GET usernested/_search { "query": { "nested": { "path": "tags&quo ...
随机推荐
- RabbitMQ消息队列(七)-通过fanout模式将消息推送到多个Queue中(.Net Core版)
前面第六章我们使用的是direct直连模式来进行消息投递和分发.本章将介绍如何使用fanout模式将消息推送到多个队列. 有时我们会遇到这样的情况,多个功能模块都希望得到完整的消息数据.例如一个log ...
- 痞子衡嵌入式:串口调试工具Jays-PyCOM诞生记(2)- 界面构建(wxFormBuilder3.8.0)
大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是串口调试工具Jays-PyCOM诞生之界面构建. 一个软件的UI界面是非常重要的,这是软件与用户交互的接口,软件功能即使再强大,但如果没 ...
- js内存深入学习(二)
继上一篇文章 js内存深入学习(一) 3. 内存泄漏 对于持续运行的服务进程(daemon),必须及时释放不再用到的内存.否则,内存占用越来越高,轻则影响系统性能,重则导致进程崩溃. 对于不再用到的内 ...
- 记录:C++类内存分布(虚继承与虚函数)
工具:VS2013 先说一下VS环境下查看类内存分布的方法: 先选择左侧的C/C++->命令行,然后在其他选项这里写上/d1 reportAllClassLayout,它可以看到所有相关类的内存 ...
- WebBrowser Cookie
WebBrowser的Cookie操作 .在WebBrowser中获取Cookie CookieContainer myCookieContainer = new CookieContainer(); ...
- WCF消息交换模式之请求-响应模式
WCF的消息交换模式(MEP)有三种:请求/响应.单向模式和双工模式.WCF的默认MEP是请求/响应模式. 请求/响应模式操作签名代码如下,无需指定模式,默认就是. [OperationContrac ...
- .NET Core整理之配置EFCore
1.新建ASP.NET Core Web应用程序 2.从NuGet下载安装以下工具包 Microsoft.EntityFrameworkCore Microsoft.EntityFrameworkCo ...
- Mac下如何用SSH连接远程Linux服务器
终端命令 a).打开Mac的命令终端 b).输入ssh -p 22 root@102.210.86.213 它会提示你输入密码,输入正确的密码之后,你就发现已经登陆成功了.(22: 端口号 root ...
- C#添加PDF页眉——添加文本、图片到页眉
页眉常用于显示文档的附加信息,我们可以在页眉中插入文本或者图形,例如,页码.日期.公司徽标.文档标题.文件名或作者名等等.那么我们如何以编程的方式添加页眉呢?今天,这篇文章向大家分享如何使用了免费组件 ...
- php 关于经纬度距离计算方法
1.PHP实现通过经纬度计算距离 单位为公里 function getdistance($lng1,$lat1,$lng2,$lat2)//根据经纬度计算距离 { //将角度转为狐度 $radLat ...