# Help in query

**URL:** <https://discuss.elastic.co/t/help-in-query/18419>\
**Category:** Elasticsearch\
**Created:** [July 1, 2014, 4:49pm UTC](https://discuss.elastic.co/t/help-in-query/18419 "2014-07-01T16:49:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![surfer](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@surfer](https://discuss.elastic.co/u/surfer)\
**Post date:** [July 1, 2014, 4:49pm UTC](https://discuss.elastic.co/t/help-in-query/18419/1 "2014-07-01T16:49:06Z")

</div>

Hi,

I'm indexing something like:

first doc = { "v4" : "myvalue" }  
second doc = { "v1" : [{ "v4" : "myvalue" }, { "v5" : "anothervalue" }] }  
third doc = { "v1" : [{ "v2" : [ {"v4" : "myvalue" }] } ] }  
fourth doc = { "v1" : [{ "v2" : [ { "v3" : [ { "v4" : "myvalue" }] }  
] } ] }

so nested dictionaries and array of dictionaries.

I was wondering if there is a query to obtain all the docs that have  
"v4" : "myvalue" and another condition that has to be satisfied is that  
this must happen inside a "v1" dictionary and whatever number of  
intermediate dictionaries (none, v2, v2 and v3) that is with the three  
docs written my query should give:

second doc, third doc and fourth doc

Any hint is appreciated  
giovanni

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/53B2E682.40700%40crs4.it](https://groups.google.com/d/msgid/elasticsearch/53B2E682.40700%40crs4.it).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)\
**Post date:** [July 1, 2014, 5:19pm UTC](https://discuss.elastic.co/t/help-in-query/18419/2 "2014-07-01T17:19:24Z")

</div>

Hello Giovanni ,

I feel this will help -

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Thanks  
Vineeth

On Tue, Jul 1, 2014 at 10:19 PM, surfer [surfer@crs4.it](mailto:surfer@crs4.it) wrote:

> Hi,
> 
> I'm indexing something like:
> 
> first doc = { "v4" : "myvalue" }  
> second doc = { "v1" : [{ "v4" : "myvalue" }, { "v5" : "anothervalue" }] }  
> third doc = { "v1" : [{ "v2" : [ {"v4" : "myvalue" }] } ] }  
> fourth doc = { "v1" : [{ "v2" : [ { "v3" : [ { "v4" : "myvalue" }] }  
> ] } ] }
> 
> so nested dictionaries and array of dictionaries.
> 
> I was wondering if there is a query to obtain all the docs that have  
> "v4" : "myvalue" and another condition that has to be satisfied is that  
> this must happen inside a "v1" dictionary and whatever number of  
> intermediate dictionaries (none, v2, v2 and v3) that is with the three  
> docs written my query should give:
> 
> second doc, third doc and fourth doc
> 
> Any hint is appreciated  
> giovanni
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/53B2E682.40700%40crs4.it](https://groups.google.com/d/msgid/elasticsearch/53B2E682.40700%40crs4.it).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D1MiPxmqSUFaxZg7%3DsiUaUQPSkn\_XWUfycz%2BqmXpEJbQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D1MiPxmqSUFaxZg7%3DsiUaUQPSkn_XWUfycz%2BqmXpEJbQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![surfer](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@surfer](https://discuss.elastic.co/u/surfer)\
**Post date:** [July 2, 2014, 7:24am UTC](https://discuss.elastic.co/t/help-in-query/18419/3 "2014-07-02T07:24:46Z")

</div>

That definitely helped it. Thank you Vineeth  
Regards  
giovanni

On 07/01/2014 07:19 PM, vineeth mohan wrote:

> Hello Giovanni ,
> 
> I feel this will help
> 
> - [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_literal_multi_match_literal_query_2.html#_wildcards_in_field_names)
> 
> Thanks  
> Vineeth
> 
> On Tue, Jul 1, 2014 at 10:19 PM, surfer \<surfer@crs4.it  
> [mailto:surfer@crs4.it](mailto:surfer@crs4.it)\> wrote:
> 
> ```
> Hi,
> 
> I'm indexing something like:
> 
> first doc = { "v4" : "myvalue" }
> second doc = { "v1" : [ { "v4" : "myvalue" }, { "v5" :
> "anothervalue" } ] }
> third doc = { "v1" : [{ "v2" : [ {"v4" : "myvalue" }] } ] }
> fourth doc = { "v1" : [ { "v2" : [ { "v3" : [ { "v4" :
> "myvalue" }] }
> ] } ] }
> 
> so nested dictionaries and array of dictionaries.
> 
> I was wondering if there is a query to obtain all the docs that have
> "v4" : "myvalue" and another condition that has to be satisfied is
> that
> this must happen inside a "v1" dictionary and whatever number of
> intermediate dictionaries (none, v2, v2 and v3) that is with the
> three
> docs written my query should give:
> 
> second doc, third doc and fourth doc
> 
> Any hint is appreciated
> giovanni
> 
> --
> You received this message because you are subscribed to the Google
> Groups "elasticsearch" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to elasticsearch+unsubscribe@googlegroups.com
> <mailto:elasticsearch%2Bunsubscribe@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/53B2E682.40700%40crs4.it.
> For more options, visit https://groups.google.com/d/optout.
> 
> ```
> 
> --  
> You received this message because you are subscribed to the Google  
> Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send  
> an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D1MiPxmqSUFaxZg7%3DsiUaUQPSkn\_XWUfycz%2BqmXpEJbQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D1MiPxmqSUFaxZg7%3DsiUaUQPSkn_XWUfycz%2BqmXpEJbQ%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D1MiPxmqSUFaxZg7%3DsiUaUQPSkn\_XWUfycz%2BqmXpEJbQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D1MiPxmqSUFaxZg7%3DsiUaUQPSkn_XWUfycz%2BqmXpEJbQ%40mail.gmail.com?utm_medium=email&utm_source=footer).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/53B3B3BE.3060307%40crs4.it](https://groups.google.com/d/msgid/elasticsearch/53B3B3BE.3060307%40crs4.it).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![surfer](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@surfer](https://discuss.elastic.co/u/surfer)\
**Post date:** [July 2, 2014, 7:27am UTC](https://discuss.elastic.co/t/help-in-query/18419/4 "2014-07-02T07:27:30Z")

</div>

oops there is an "it" that doesn't belong....  
On 07/02/2014 09:24 AM, surfer wrote:

> That definitely helped it. Thank you Vineeth  
> Regards  
> giovanni
> 
> On 07/01/2014 07:19 PM, vineeth mohan wrote:
> 
> > Hello Giovanni ,
> > 
> > I feel this will help
> > 
> > - [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/_literal_multi_match_literal_query_2.html#_wildcards_in_field_names)
> > 
> > Thanks  
> > Vineeth
> > 
> > On Tue, Jul 1, 2014 at 10:19 PM, surfer \<surfer@crs4.it  
> > [mailto:surfer@crs4.it](mailto:surfer@crs4.it)\> wrote:
> > 
> > ```
> > Hi,
> > 
> > I'm indexing something like:
> > 
> > first doc = { "v4" : "myvalue" }
> > second doc = { "v1" : [ { "v4" : "myvalue" }, { "v5" :
> > "anothervalue" } ] }
> > third doc = { "v1" : [{ "v2" : [ {"v4" : "myvalue" }] } ] }
> > fourth doc = { "v1" : [ { "v2" : [ { "v3" : [ { "v4" :
> > "myvalue" }] }
> > ] } ] }
> > 
> > so nested dictionaries and array of dictionaries.
> > 
> > I was wondering if there is a query to obtain all the docs that have
> > "v4" : "myvalue" and another condition that has to be satisfied
> > is that
> > this must happen inside a "v1" dictionary and whatever number of
> > intermediate dictionaries (none, v2, v2 and v3) that is with the
> > three
> > docs written my query should give:
> > 
> > second doc, third doc and fourth doc
> > 
> > Any hint is appreciated
> > giovanni
> > 
> > --
> > You received this message because you are subscribed to the
> > Google Groups "elasticsearch" group.
> > To unsubscribe from this group and stop receiving emails from it,
> > send an email to elasticsearch+unsubscribe@googlegroups.com
> > <mailto:elasticsearch%2Bunsubscribe@googlegroups.com>.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/elasticsearch/53B2E682.40700%40crs4.it.
> > For more options, visit https://groups.google.com/d/optout.
> > 
> > ```
> > 
> > --  
> > You received this message because you are subscribed to the Google  
> > Groups "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it,  
> > send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> > [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D1MiPxmqSUFaxZg7%3DsiUaUQPSkn\_XWUfycz%2BqmXpEJbQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D1MiPxmqSUFaxZg7%3DsiUaUQPSkn_XWUfycz%2BqmXpEJbQ%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D1MiPxmqSUFaxZg7%3DsiUaUQPSkn\_XWUfycz%2BqmXpEJbQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D1MiPxmqSUFaxZg7%3DsiUaUQPSkn_XWUfycz%2BqmXpEJbQ%40mail.gmail.com?utm_medium=email&utm_source=footer).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google  
> Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send  
> an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com)  
> [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/53B3B3BE.3060307%40crs4.it](https://groups.google.com/d/msgid/elasticsearch/53B3B3BE.3060307%40crs4.it)  
> [https://groups.google.com/d/msgid/elasticsearch/53B3B3BE.3060307%40crs4.it?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/53B3B3BE.3060307%40crs4.it?utm_medium=email&utm_source=footer).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/53B3B462.5060405%40crs4.it](https://groups.google.com/d/msgid/elasticsearch/53B3B462.5060405%40crs4.it).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:18am UTC](https://discuss.elastic.co/t/help-in-query/18419/5 "2017-07-06T01:18:30Z")

</div>


