• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
导航菜单
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • windows
  • 服务器硬件
  • 服务器运维
  • 云计算
  • 虚拟化
  • IIS教程
  • Linux
  • Apache
  • Ftp
  • DNS
  • Nginx
您的位置:首页 > 服务器 >云计算 > Elasticsearch之Nested Query,elasticsearch

Elasticsearch之Nested Query,elasticsearch

作者:网友 字体:[增加 减小] 来源:互联网

本文主要包含elasticsearch nested,elasticsearch query,elasticsearch,elasticsearch教程,elasticsearch官网等服务器相关知识,网友希望可以进行参考

Elasticsearch之Nested Query,elasticsearch


                                                     (这是一个小系列:请戳:Elasticsearch之Nested(嵌套)系列,查看其他nested相关文章)

Because nested objects are indexed as separate hidden documents, we can’t query them directly.Instead, 

we have to use the nested?query or nested?filter to access them:

   nested object作为一个独立隐藏文档单独建索引,因此,我们不能直接查询它们。取而代之,我们必须使用nested查询或者nested filter来接触它们:

curl -XGET 'localhost:9200/my_index' -d '
{
  "query":{
     "bool":{
	    "must":[
		   {"match":{"title":"eggs"}},
		   {
		     "nested":{
			    "path":"comments",
				"query":{
				   "bool":{
				      "must":[
					     {"match":{"comments.name":"john"}},
						 {"match":{"comments.age":28}}
					  ]
				   }
				}
			 }
		   }
		]
	 }
  }
}

   A nested field can contain other nested fields. Similarly, a nested query can contain other nested queries. 

The nesting hierarchy is applied as you would expect.

   一个nested字段可以包含其他的nested 字段。相似地,一个nested查询可以包含其他nested查询。只要你希望,你就可以使用嵌套层。

  Of course, a nested query could match several nested documents. Each matching nested document would have its own

relevance score, but these multiple scores need to be reduced to a single score that can be applied to the root document.

  当然,一个nested查询可以匹配多个nested文本。每个匹配的nested文本都有它自己相关评分,但是这些评分必须归为一个总分应用于根文本上。

  By default, it averages the scores of the matching nested documents. This can be controlled by setting the score_mode 

parameter to avg, max, sum, or even none (in which case the root document gets a constant score of 1.0).

  默认会平均所有匹配的nested文本的分数。当然,也可以通过设定score_modec参数为avg,max,sum,或者甚至为none(根文本获得一致评分1.0)。

 

curl -XGET 'localhost:9200/my_index' -d '
{
  "query":{
     "bool":{
	    "must":[
		   {"match":{"title":"eggs"}},
		   {
		     "nested":{
			    "path":"comments",
				"score_mode":"max",
				"query":{
				   "bool":{
				      "must":[
					     {"match":{"comments.name":"john"}},
						 {"match":{"comments.age":28}}
					  ]
				   }
				}
			 }
		   }
		]
	 }
  }
}

   A nested filter behaves much like a nested query, except that it doesn’t accept the score_mode parameter. It can

be used only in filter context—such as inside a filtered query—and it behaves like any other filter: 

it includes or excludes, but it doesn’t score.

一个nested过滤行为和一个nested 查询非常像,除了它不接受score_mode。它只会用在过滤场景中——比如一个过滤查询中——它的行为同样类似其他过滤:

要么包括,要么不包括,不会评分。


原文:http://www.elastic.co/guide/en/elasticsearch/guide/current/nested-query.html

分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • Elasticsearch之Nested Query,elasticsearch
  • Elasticsearch之Nested Aggregation,elasticsearch
  • Elasticsearch之Nested Object Mapping,elasticsearch
  • Elasticsearch之Nested Sorting,elasticsearch
  • Elasticsearch之Nested(嵌套)系列,elasticsearch

相关文章

  • MapReduce之RecordReader组件源码解析及实例,mapreduce实例
  • kernel interrupt,interrupt
  • Hadoop之——自定义分组比较器实现分组功能,hadoop分组
  • HDP出现Could not create the Java Virtual Machine解决方法,hdpvirtual
  • 配置tomcat默认项目,tomcat默认项目
  • Hadoop Spark 集群简便安装总结,hadoopspark集群
  • HBase RegionServer详解(未完),hbaseregionserver
  • python RESTful API框架:Eve 快速入门,pythonrestful
  • 通过 Web Service 调用Pentaho BI 的API,pentahobi
  • @PathVariable和@RequestParam的区别,@pathvariable

文章分类

  • windows
  • 服务器硬件
  • 服务器运维
  • 云计算
  • 虚拟化
  • IIS教程
  • Linux
  • Apache
  • Ftp
  • DNS
  • Nginx

最近更新的内容

    • Centos 64下实现socket通信,centos64下
    • kafka 安装步骤,kafka安装步骤
    • Ceph集群磁盘没有剩余空间的解决方法,ceph集群
    • 大数据分析与应用的8个场景
    • flume 组件概述与列表
    • 配置tomcat默认项目,tomcat默认项目
    • spark core源码分析14 参数配置,sparkcore
    • kernel interrupt,interrupt
    • hive grouping sets 和 cube 用法,hivegrouping
    • Mahout-HashMap的进化版FastByIdMap,mahout

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有