SQL 子查询的 ElasticSearch 等效项是什么? [英] What is the ElasticSearch equivalent for an SQL subquery?

查看:30
本文介绍了SQL 子查询的 ElasticSearch 等效项是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您能否在 ElasticSearch 中逻辑嵌套查询,因此一个查询的输出是另一个查询的输入.另一种提问方式是如何将查询链接或管道连接在一起?

Can you nest queries logically in ElasticSearch, so the output of one query is the input to another query. Another, way to ask is how can I chain or pipe queries together?

这应该类似于 SQL 中的 IN 运算符或子查询

This should be analogous to the IN operator or subqueries in SQL

即:-选择 au_lname, au_fname, title from(从 pubs.dbo.authors 中选择 au_lname、au_fname、au_id其中状态 = 'CA')或

i.e.:- select au_lname, au_fname, title from (select au_lname, au_fname, au_id from pubs.dbo.authors where state = 'CA') or

选择名称来自 AdventureWorks2008R2.Production.Product哪里 ListPrice =(选择标价来自 AdventureWorks2008R2.Production.ProductWHERE 名称 = '链环螺栓');

SELECT Name FROM AdventureWorks2008R2.Production.Product WHERE ListPrice = (SELECT ListPrice FROM AdventureWorks2008R2.Production.Product WHERE Name = 'Chainring Bolts' );

推荐答案

Elasticsearch 不支持子查询;您需要执行第一个查询,然后使用第一个查询的结果作为输入构造第二个查询.

Elasticsearch doesn't support subqueries; you would need to perform your first query, then construct a second query using the results of the first query as an input.

这篇关于SQL 子查询的 ElasticSearch 等效项是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆