# Querying inside fields of an object

**URL:** <https://discuss.elastic.co/t/querying-inside-fields-of-an-object/11410>\
**Category:** Elasticsearch\
**Created:** [April 2, 2013, 4:27am UTC](https://discuss.elastic.co/t/querying-inside-fields-of-an-object/11410 "2013-04-02T04:27:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thesuaves22](https://avatars.discourse-cdn.com/v4/letter/t/c77e96/32.png) [@thesuaves22](https://discuss.elastic.co/u/thesuaves22)\
**Post date:** [April 2, 2013, 4:27am UTC](https://discuss.elastic.co/t/querying-inside-fields-of-an-object/11410/1 "2013-04-02T04:27:10Z")

</div>

I am having a problem determining what the correct mapping is for the  
search behavior I want. I want to query ?q=a.b:stuff and get results for  
"stuff" inside of a.b.value1 and a.b.value2. What I need is basically a  
field wildcard search ?q=a.b.\*:stuff to find the string "stuff" in any  
field or child object's field inside of a.b. A sample mapping of my data  
is below.

{  
"mappings":{  
"objFoo":{  
"\_all":{  
"enabled":true  
},  
"properties":{  
"a":{  
"properties":{  
"b":{  
"properties":{  
"value1":{  
"type":"string"  
},  
"value2":{  
"type":"string"  
}  
}  
}  
}  
}  
}  
}  
}  
}

How can I find a string in the value1 or value2 fields by querying a.b?

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![thesuaves22](https://avatars.discourse-cdn.com/v4/letter/t/c77e96/32.png) [@thesuaves22](https://discuss.elastic.co/u/thesuaves22)\
**Post date:** [April 2, 2013, 4:49am UTC](https://discuss.elastic.co/t/querying-inside-fields-of-an-object/11410/2 "2013-04-02T04:49:06Z")

</div>

So I got it working temporarily by using an escaped wildcard on the field:

?q=a.b.\*:stuff

This will probably work for my needs, but it would be awesome to get  
?q=a.b:stuff working (without the field wildcard) if possible.

On Tuesday, April 2, 2013 12:27:10 AM UTC-4, [thesu...@gmail.com](mailto:thesu...@gmail.com) wrote:

> I am having a problem determining what the correct mapping is for the  
> search behavior I want. I want to query ?q=a.b:stuff and get results for  
> "stuff" inside of a.b.value1 and a.b.value2. What I need is basically a  
> field wildcard search ?q=a.b.\*:stuff to find the string "stuff" in any  
> field or child object's field inside of a.b. A sample mapping of my data  
> is below.
> 
> {  
> "mappings":{  
> "objFoo":{  
> "\_all":{  
> "enabled":true  
> },  
> "properties":{  
> "a":{  
> "properties":{  
> "b":{  
> "properties":{  
> "value1":{  
> "type":"string"  
> },  
> "value2":{  
> "type":"string"  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }  
> }
> 
> How can I find a string in the value1 or value2 fields by querying a.b?

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:43am UTC](https://discuss.elastic.co/t/querying-inside-fields-of-an-object/11410/3 "2017-07-06T02:43:19Z")

</div>


