Elasticsearch之Nested Object Mapping

Setting up a nested field is simple—where you would normally specify type object, make it type nested instead:

创建一个nested 字段很简单——只要在你通常指定object类型的地方,改成nested类型就行:

curl -XPUT 'localhost:9200/my_index' -d '
{
  "mappings":{
     "blogpost":{
	     "properties":{
		     "comments":{
			    "type":"nested",
				"properties":{
				   "name":    {"type":"string"    },
				   "comment": { "type": "string"  },
                   "age":     { "type": "short"   },
                   "stars":   { "type": "short"   },
                   "date":    { "type": "date"    }
				}
			 }
		 }
	 }
  }
}

原文:http://www.elastic.co/guide/en/elasticsearch/guide/master/nested-mapping.html

时间: 2024-08-01 03:18:04

Elasticsearch之Nested Object Mapping的相关文章

Elasticsearch之Nested Object

Given the fact that creating, deleting, and updating a single document in Elasticsearch is atomic, it makes sense to store closely related entities within the same document. 考虑到在ES里面建立,删除和更新一个单一文本是原子性的,那么将相关实体保存在同一个文本里面是有意义的. PUT /my_index/blogpost/1

Elasticsearch之Nested(嵌套)系列

工作需要,专门花了一下午研究了Elasticsearch里面的nested.最好的材料还是官网上面的Elasticsearch: The Definitive Guide, 所以直接将里面涉及到nested的文章找来看了看,顺便把它们翻译了,贴出来和大家分享.同时综合考虑了一下,把英语大体的 英文原文也一起贴出来了.希望这样能够适应不同读者的口味. 文章都顺手翻译了,每天贴出来一篇吧. 1.Elasticsearch之Nested Object 2.Elasticsearch之Nested Ob

Elasticsearch之Nested Aggregation

(这是一个小系列:请戳:Elasticsearch之Nested(嵌套)系列,查看其他nested相关文章) In the same way as we need to use the special nested query to gain access to nested objects at search time, the dedicated nested aggregation allows us to aggregate fields in nested objects: 与在检索时

Elasticsearch NEST – Examples for mapping between Query and C#

Elasticsearch NEST – Examples for mapping between Query and C# During my training with Elasticsearch I would like to map a query with GET/POST method to C# syntax of NEST. It's very helpful for me to see how NEST composes its internal queries and sen

Elasticsearch之Nested Sorting

(这是一个小系列:请戳:Elasticsearch之Nested(嵌套)系列,查看其他nested相关文章) It is possible to sort by the value of a nested field, even though the value exists in a separate nested document. To make the result more interesting, we will add another record: 尽管存在于独立的nested文

elasticsearch index 之 put mapping

mapping机制使得elasticsearch索引数据变的更加灵活,近乎于no schema.mapping可以在建立索引时设置,也可以在后期设置.后期设置可以是修改mapping(无法对已有的field属性进行修改,一般来说只是增加新的field)或者对没有mapping的索引设置mapping.put mapping操作必须是master节点来完成,因为它涉及到集群matedata的修改,同时它跟index和type密切相关.修改只是针对特定index的特定type. 在Action su

elasticsearch在已有mapping添加字段

最近在接手elasticsearch 方面的工作,其中向已有的mapping添加新的字段的时候,一开始在网上找 资料,发现 网上 的资料都是关于更新mapping中已有字段类型的,所以写 一篇关于向 已有mapping添加新 字段的文章,仅供elasticsearch的新手学习. curl -XPUT http://localhost:9200/test/regist/_mapping -d '{ "properties": { "user_id": { "

elasticsearch的rest搜索---mapping

目录: 一.针对这次装B 的解释 二.下载,安装插件elasticsearch-1.7.0   三.索引的mapping 四. 查询 五.对于相关度的大牛的文档 三.mapping 1. 索引的mapping记录了对字段的描述,是否分词,是否存储等----没有细细的研究,只是简单的区分了field的不同产生的不同的mapping 2. 创建mapping,直接指定mapping,url中声明创建的索引的 { "person":{ "_all":{"enab

rest-assured的对象映射(Object Mapping)

rest-assured支持映射Java对象到Json和XML以及从Json和XML中映射到Java对象.Json映射需要在classpath 中有Jackson.Jackson 2或者是Gson,XML映射需要在classpath 中有JAXB. 1.JsonPath映射 例如:让我们来看一下我们想提取第一个winner到JavaBean对象中: Json数据准备: 1 {"lotto":{ 2 "lottoId":5, 3 "winning-numbe