elasticsearch:创建内部查询

时间:2017-06-20 09:35:48

标签: elasticsearch

这是我的日志:

指数:购买

{details: { name: john, corID: 12345678 }}
{details: { name: bill, corID: 96657545}}

{town: NY, ID: 12345678 }
{a:b , v: g}
{a: hi, b: 12345678}
{g:f , k:ggg777 }

我想创建一个查询,对于给定名称,查询将在purchase索引中搜索details.name=<name>,解压缩details.corID并在索引中搜索包含details.corID

上述细节的例子:

name =“john”

查询结果 (所有日志都有12345678

{details: { name: john, corID: 12345678 }}
{town: NY, ID: 12345678 }
{a: hi, b: 12345678}

修改

这就是我在SQL中的表现:

SELECT * FROM purchase
where  corID= 
     (SELECT details.corID 
      FROM [purchase]
      where  details.name = "john")

0 个答案:

没有答案