# Search all subfields

**URL:** <https://discuss.elastic.co/t/search-all-subfields/11206>\
**Category:** Elasticsearch\
**Created:** [March 19, 2013, 1:04pm UTC](https://discuss.elastic.co/t/search-all-subfields/11206 "2013-03-19T13:04:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pat\_3](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@Pat\_3](https://discuss.elastic.co/u/Pat_3)\
**Post date:** [March 19, 2013, 1:04pm UTC](https://discuss.elastic.co/t/search-all-subfields/11206/1 "2013-03-19T13:04:53Z")

</div>

Hi,

probably this question has been asked before, but I couldn't find an  
appropriate answer. I have a document structure like this  
{  
"broadcast": {  
"type": "nested",  
"properties": {  
"date": { "type": "date" },  
"duration": { "type": "long" },  
"title": { "type": "string" }  
}  
}  
}  
and I want to query "broadcast" including all subfields. We currently use  
Oracle Text, where I can simply query the "broadcast" field and all  
subfields are automatically included. I need to migrate to ES for several  
reasons and I need to make subfield searching available again.  
I already tried different approaches:

1. Using a "multi\_match" query with wildcards ( "fields" :  
["broadcast.\*"] ). This doesn't seem to work (the query returns an error)  
since the subfields have different types. I know that searching for a  
string in a date field doesn't seem to make much sense, but in Oracle Text  
you can get a match for a date if you search for a string like "2000-01-01".
2. Using "include\_in\_parent". I was hoping that the values of the  
subfields are included in the parent field.
3. Using "multi\_field" type. I could copy all values to a different  
field, but not to the parent field.

I heard that SOLR has a copyfield function, which would be a solution to my  
problem. I cannot use SOLR since I need nested objects to avoid cross  
object matches. I often read that one can achieve the same functionality in  
ES, but I couldn't find a solution to my problem.

--  
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:** ![Pat\_3](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@Pat\_3](https://discuss.elastic.co/u/Pat_3)\
**Post date:** [March 19, 2013, 2:41pm UTC](https://discuss.elastic.co/t/search-all-subfields/11206/2 "2013-03-19T14:41:50Z")

</div>

Ok, I found one working solution. With the mapping below, I can search all  
subfields of "broadcast" as a string.

{  
"test": {  
"type": "nested",  
"include\_in\_parent": "true",  
"properties": {  
"broadcast": {  
"properties": {  
"date": {  
"type": "multi\_field",  
"path": "just\_name",  
"fields": {  
"date": {  
"type": "date"  
},  
"broadcast": {  
"type": "string",  
"index": "not\_analyzed"  
}  
}  
},  
"duration": {  
"type": "multi\_field",  
"path": "just\_name",  
"fields": {  
"duration": {  
"type": "long"  
},  
"broadcast": {  
"type": "string"  
}  
}  
},  
"title": {  
"type": "multi\_field",  
"path": "just\_name",  
"fields": {  
"title": {  
"type": "string"  
},  
"broadcast": {  
"type": "string"  
}  
}  
}  
}  
}  
}  
}  
}

But now I have another problem: our hierarchies are not limited to one  
level. I want to make "broadcast" a subfield of some other field "foo" and  
its data should be searchable in "foo". So "broadcast" should be a  
combination of a "nested" and a "multi\_field" type. Is that possible  
somehow?

--  
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:** ![roytmana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roytmana/32/44855_2.png) [@roytmana](https://discuss.elastic.co/u/roytmana)\
**Post date:** [March 19, 2013, 5:51pm UTC](https://discuss.elastic.co/t/search-all-subfields/11206/3 "2013-03-19T17:51:45Z")

</div>

for this and other (such as indexing aggregated fields several times say  
normal, stemmed, shingled) reasons it would be nice to be able to  
establish an aggregation chain where aggergated (via multi\_field) fields  
would be able to feed into other aggregated fields  
it can be achieved with current multifield but at a cost of a highly  
redundant mapping. while having such redundant mapping may not be a big  
deal for schemas with few fields it is a very big deal for schemas with  
hundreds of fields

On Tuesday, March 19, 2013 9:04:53 AM UTC-4, Pat wrote:

> Hi,
> 
> probably this question has been asked before, but I couldn't find an  
> appropriate answer. I have a document structure like this  
> {  
> "broadcast": {  
> "type": "nested",  
> "properties": {  
> "date": { "type": "date" },  
> "duration": { "type": "long" },  
> "title": { "type": "string" }  
> }  
> }  
> }  
> and I want to query "broadcast" including all subfields. We currently use  
> Oracle Text, where I can simply query the "broadcast" field and all  
> subfields are automatically included. I need to migrate to ES for several  
> reasons and I need to make subfield searching available again.  
> I already tried different approaches:
> 
> 1. Using a "multi\_match" query with wildcards ( "fields" :  
> ["broadcast.\*"] ). This doesn't seem to work (the query returns an error)  
> since the subfields have different types. I know that searching for a  
> string in a date field doesn't seem to make much sense, but in Oracle Text  
> you can get a match for a date if you search for a string like "2000-01-01".
> 2. Using "include\_in\_parent". I was hoping that the values of the  
> subfields are included in the parent field.
> 3. Using "multi\_field" type. I could copy all values to a different  
> field, but not to the parent field.
> 
> I heard that SOLR has a copyfield function, which would be a solution to  
> my problem. I cannot use SOLR since I need nested objects to avoid cross  
> object matches. I often read that one can achieve the same functionality in  
> ES, but I couldn't find a solution to my problem.

--  
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:** ![Pat\_3](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@Pat\_3](https://discuss.elastic.co/u/Pat_3)\
**Post date:** [March 20, 2013, 8:37am UTC](https://discuss.elastic.co/t/search-all-subfields/11206/4 "2013-03-20T08:37:09Z")

</div>

Can you give me an example how this can be achieved with multifield?

Am Dienstag, 19. März 2013 18:51:45 UTC+1 schrieb AlexR:

> for this and other (such as indexing aggregated fields several times say  
> normal, stemmed, shingled) reasons it would be nice to be able to  
> establish an aggregation chain where aggergated (via multi\_field) fields  
> would be able to feed into other aggregated fields  
> it can be achieved with current multifield but at a cost of a highly  
> redundant mapping. while having such redundant mapping may not be a big  
> deal for schemas with few fields it is a very big deal for schemas with  
> hundreds of fields
> 
> On Tuesday, March 19, 2013 9:04:53 AM UTC-4, Pat wrote:
> 
> > Hi,
> > 
> > probably this question has been asked before, but I couldn't find an  
> > appropriate answer. I have a document structure like this  
> > {  
> > "broadcast": {  
> > "type": "nested",  
> > "properties": {  
> > "date": { "type": "date" },  
> > "duration": { "type": "long" },  
> > "title": { "type": "string" }  
> > }  
> > }  
> > }  
> > and I want to query "broadcast" including all subfields. We currently use  
> > Oracle Text, where I can simply query the "broadcast" field and all  
> > subfields are automatically included. I need to migrate to ES for several  
> > reasons and I need to make subfield searching available again.  
> > I already tried different approaches:
> > 
> > 1. Using a "multi\_match" query with wildcards ( "fields" :  
> > ["broadcast.\*"] ). This doesn't seem to work (the query returns an error)  
> > since the subfields have different types. I know that searching for a  
> > string in a date field doesn't seem to make much sense, but in Oracle Text  
> > you can get a match for a date if you search for a string like "2000-01-01".
> > 2. Using "include\_in\_parent". I was hoping that the values of the  
> > subfields are included in the parent field.
> > 3. Using "multi\_field" type. I could copy all values to a different  
> > field, but not to the parent field.
> > 
> > I heard that SOLR has a copyfield function, which would be a solution to  
> > my problem. I cannot use SOLR since I need nested objects to avoid cross  
> > object matches. I often read that one can achieve the same functionality in  
> > ES, but I couldn't find a solution to my problem.

--  
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:** ![roytmana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roytmana/32/44855_2.png) [@roytmana](https://discuss.elastic.co/u/roytmana)\
**Post date:** [March 20, 2013, 3:03pm UTC](https://discuss.elastic.co/t/search-all-subfields/11206/5 "2013-03-20T15:03:34Z")

</div>

Pat,

It is what you have been doing with multifields say you have abcd field  
which consists of ab and cd fields and those consist of a,b and c,d  
properties of your json. when you map a you would have it mapped to both ab  
and abcd same for b,c and d. I think it should work but with deep and wide  
hierarchy it will quickly become enormous and error prone. I wish there  
were a way to tell that abcd consists of ab and cd then you can roll up  
your fields nicely and reuse it across mappings

Alex

On Wednesday, March 20, 2013 4:37:09 AM UTC-4, Pat wrote:

> Can you give me an example how this can be achieved with multifield?
> 
> Am Dienstag, 19. März 2013 18:51:45 UTC+1 schrieb AlexR:
> 
> > for this and other (such as indexing aggregated fields several times say  
> > normal, stemmed, shingled) reasons it would be nice to be able to  
> > establish an aggregation chain where aggergated (via multi\_field) fields  
> > would be able to feed into other aggregated fields  
> > it can be achieved with current multifield but at a cost of a highly  
> > redundant mapping. while having such redundant mapping may not be a big  
> > deal for schemas with few fields it is a very big deal for schemas with  
> > hundreds of fields
> > 
> > On Tuesday, March 19, 2013 9:04:53 AM UTC-4, Pat wrote:
> > 
> > > Hi,
> > > 
> > > probably this question has been asked before, but I couldn't find an  
> > > appropriate answer. I have a document structure like this  
> > > {  
> > > "broadcast": {  
> > > "type": "nested",  
> > > "properties": {  
> > > "date": { "type": "date" },  
> > > "duration": { "type": "long" },  
> > > "title": { "type": "string" }  
> > > }  
> > > }  
> > > }  
> > > and I want to query "broadcast" including all subfields. We currently  
> > > use Oracle Text, where I can simply query the "broadcast" field and all  
> > > subfields are automatically included. I need to migrate to ES for several  
> > > reasons and I need to make subfield searching available again.  
> > > I already tried different approaches:
> > > 
> > > 1. Using a "multi\_match" query with wildcards ( "fields" :  
> > > ["broadcast.\*"] ). This doesn't seem to work (the query returns an error)  
> > > since the subfields have different types. I know that searching for a  
> > > string in a date field doesn't seem to make much sense, but in Oracle Text  
> > > you can get a match for a date if you search for a string like "2000-01-01".
> > > 2. Using "include\_in\_parent". I was hoping that the values of the  
> > > subfields are included in the parent field.
> > > 3. Using "multi\_field" type. I could copy all values to a different  
> > > field, but not to the parent field.
> > > 
> > > I heard that SOLR has a copyfield function, which would be a solution to  
> > > my problem. I cannot use SOLR since I need nested objects to avoid cross  
> > > object matches. I often read that one can achieve the same functionality in  
> > > ES, but I couldn't find a solution to my problem.

--  
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:** ![Pat\_3](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@Pat\_3](https://discuss.elastic.co/u/Pat_3)\
**Post date:** [March 20, 2013, 3:19pm UTC](https://discuss.elastic.co/t/search-all-subfields/11206/6 "2013-03-20T15:19:07Z")

</div>

Ok, i get what you mean. Actually I am already trying to extend my mapping  
this way and exactly like you said, this is enormous and error prone...

Am Mittwoch, 20. März 2013 16:03:34 UTC+1 schrieb AlexR:

> Pat,
> 
> It is what you have been doing with multifields say you have abcd field  
> which consists of ab and cd fields and those consist of a,b and c,d  
> properties of your json. when you map a you would have it mapped to both ab  
> and abcd same for b,c and d. I think it should work but with deep and wide  
> hierarchy it will quickly become enormous and error prone. I wish there  
> were a way to tell that abcd consists of ab and cd then you can roll up  
> your fields nicely and reuse it across mappings
> 
> Alex
> 
> On Wednesday, March 20, 2013 4:37:09 AM UTC-4, Pat wrote:
> 
> > Can you give me an example how this can be achieved with multifield?
> > 
> > Am Dienstag, 19. März 2013 18:51:45 UTC+1 schrieb AlexR:
> > 
> > > for this and other (such as indexing aggregated fields several times say  
> > > normal, stemmed, shingled) reasons it would be nice to be able to  
> > > establish an aggregation chain where aggergated (via multi\_field) fields  
> > > would be able to feed into other aggregated fields  
> > > it can be achieved with current multifield but at a cost of a highly  
> > > redundant mapping. while having such redundant mapping may not be a big  
> > > deal for schemas with few fields it is a very big deal for schemas with  
> > > hundreds of fields
> > > 
> > > On Tuesday, March 19, 2013 9:04:53 AM UTC-4, Pat wrote:
> > > 
> > > > Hi,
> > > > 
> > > > probably this question has been asked before, but I couldn't find an  
> > > > appropriate answer. I have a document structure like this  
> > > > {  
> > > > "broadcast": {  
> > > > "type": "nested",  
> > > > "properties": {  
> > > > "date": { "type": "date" },  
> > > > "duration": { "type": "long" },  
> > > > "title": { "type": "string" }  
> > > > }  
> > > > }  
> > > > }  
> > > > and I want to query "broadcast" including all subfields. We currently  
> > > > use Oracle Text, where I can simply query the "broadcast" field and all  
> > > > subfields are automatically included. I need to migrate to ES for several  
> > > > reasons and I need to make subfield searching available again.  
> > > > I already tried different approaches:
> > > > 
> > > > 1. Using a "multi\_match" query with wildcards ( "fields" :  
> > > > ["broadcast.\*"] ). This doesn't seem to work (the query returns an error)  
> > > > since the subfields have different types. I know that searching for a  
> > > > string in a date field doesn't seem to make much sense, but in Oracle Text  
> > > > you can get a match for a date if you search for a string like "2000-01-01".
> > > > 2. Using "include\_in\_parent". I was hoping that the values of the  
> > > > subfields are included in the parent field.
> > > > 3. Using "multi\_field" type. I could copy all values to a different  
> > > > field, but not to the parent field.
> > > > 
> > > > I heard that SOLR has a copyfield function, which would be a solution  
> > > > to my problem. I cannot use SOLR since I need nested objects to avoid cross  
> > > > object matches. I often read that one can achieve the same functionality in  
> > > > ES, but I couldn't find a solution to my problem.

--  
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:** ![roytmana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roytmana/32/44855_2.png) [@roytmana](https://discuss.elastic.co/u/roytmana)\
**Post date:** [March 20, 2013, 3:24pm UTC](https://discuss.elastic.co/t/search-all-subfields/11206/7 "2013-03-20T15:24:48Z")

</div>

yeah and besides rolling up your composite fields there is another aspect.  
You often want to index the same field several times using different  
analysis - say normal, stemmed and shingled and even with one big composite  
field like built in \_all you have to do your multifield mapping 3 times  
for each flavor of your indexing. now add to it your roll up and you will  
end up with 3 times number of multifield mappings your roll up alone will  
need (and it may a dozens if you have fairly big and deeply nested json)

On Wed, Mar 20, 2013 at 11:19 AM, Pat [elasticsearch@hushmail.com](mailto:elasticsearch@hushmail.com) wrote:

> Ok, i get what you mean. Actually I am already trying to extend my mapping  
> this way and exactly like you said, this is enormous and error prone...
> 
> Am Mittwoch, 20. März 2013 16:03:34 UTC+1 schrieb AlexR:
> 
> > Pat,
> > 
> > It is what you have been doing with multifields say you have abcd field  
> > which consists of ab and cd fields and those consist of a,b and c,d  
> > properties of your json. when you map a you would have it mapped to both ab  
> > and abcd same for b,c and d. I think it should work but with deep and wide  
> > hierarchy it will quickly become enormous and error prone. I wish there  
> > were a way to tell that abcd consists of ab and cd then you can roll up  
> > your fields nicely and reuse it across mappings
> > 
> > Alex
> > 
> > On Wednesday, March 20, 2013 4:37:09 AM UTC-4, Pat wrote:
> > 
> > > Can you give me an example how this can be achieved with multifield?
> > > 
> > > Am Dienstag, 19. März 2013 18:51:45 UTC+1 schrieb AlexR:
> > > 
> > > > for this and other (such as indexing aggregated fields several times  
> > > > say normal, stemmed, shingled) reasons it would be nice to be able to  
> > > > establish an aggregation chain where aggergated (via multi\_field) fields  
> > > > would be able to feed into other aggregated fields  
> > > > it can be achieved with current multifield but at a cost of a highly  
> > > > redundant mapping. while having such redundant mapping may not be a big  
> > > > deal for schemas with few fields it is a very big deal for schemas with  
> > > > hundreds of fields
> > > > 
> > > > On Tuesday, March 19, 2013 9:04:53 AM UTC-4, Pat wrote:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > probably this question has been asked before, but I couldn't find an  
> > > > > appropriate answer. I have a document structure like this  
> > > > > {  
> > > > > "broadcast": {  
> > > > > "type": "nested",  
> > > > > "properties": {  
> > > > > "date": { "type": "date" },  
> > > > > "duration": { "type": "long" },  
> > > > > "title": { "type": "string" }  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > and I want to query "broadcast" including all subfields. We currently  
> > > > > use Oracle Text, where I can simply query the "broadcast" field and all  
> > > > > subfields are automatically included. I need to migrate to ES for several  
> > > > > reasons and I need to make subfield searching available again.  
> > > > > I already tried different approaches:
> > > > > 
> > > > > 1. Using a "multi\_match" query with wildcards ( "fields" :  
> > > > > ["broadcast.\*"] ). This doesn't seem to work (the query returns an error)  
> > > > > since the subfields have different types. I know that searching for a  
> > > > > string in a date field doesn't seem to make much sense, but in Oracle Text  
> > > > > you can get a match for a date if you search for a string like "2000-01-01".
> > > > > 2. Using "include\_in\_parent". I was hoping that the values of the  
> > > > > subfields are included in the parent field.
> > > > > 3. Using "multi\_field" type. I could copy all values to a  
> > > > > different field, but not to the parent field.
> > > > > 
> > > > > I heard that SOLR has a copyfield function, which would be a solution  
> > > > > to my problem. I cannot use SOLR since I need nested objects to avoid cross  
> > > > > object matches. I often read that one can achieve the same functionality in  
> > > > > ES, but I couldn't find a solution to my problem.
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit  
> > > > [https://groups.google.com/d/topic/elasticsearch/uM2okz3IEZo/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/uM2okz3IEZo/unsubscribe?hl=en-US)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, 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).

--  
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:** ![Pat\_3](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@Pat\_3](https://discuss.elastic.co/u/Pat_3)\
**Post date:** [March 22, 2013, 8:27am UTC](https://discuss.elastic.co/t/search-all-subfields/11206/8 "2013-03-22T08:27:35Z")

</div>

I am wondering about the way the \_all field is implemented in ES. Since you  
can decide if a field should be included in \_all or not, it seems to me  
there is a kind of "copy field" working behind the scenes. Would it be that  
difficult to extend ES so that you can define multiple "\_all" fields, each  
including different fields?

Am Mittwoch, 20. März 2013 16:24:48 UTC+1 schrieb AlexR:

> yeah and besides rolling up your composite fields there is another aspect.  
> You often want to index the same field several times using different  
> analysis - say normal, stemmed and shingled and even with one big composite  
> field like built in \_all you have to do your multifield mapping 3 times  
> for each flavor of your indexing. now add to it your roll up and you will  
> end up with 3 times number of multifield mappings your roll up alone will  
> need (and it may a dozens if you have fairly big and deeply nested json)
> 
> On Wed, Mar 20, 2013 at 11:19 AM, Pat \<[elasti...@hushmail.com](mailto:elasti...@hushmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Ok, i get what you mean. Actually I am already trying to extend my  
> > mapping this way and exactly like you said, this is enormous and error  
> > prone...
> > 
> > Am Mittwoch, 20. März 2013 16:03:34 UTC+1 schrieb AlexR:
> > 
> > > Pat,
> > > 
> > > It is what you have been doing with multifields say you have abcd field  
> > > which consists of ab and cd fields and those consist of a,b and c,d  
> > > properties of your json. when you map a you would have it mapped to both ab  
> > > and abcd same for b,c and d. I think it should work but with deep and wide  
> > > hierarchy it will quickly become enormous and error prone. I wish there  
> > > were a way to tell that abcd consists of ab and cd then you can roll up  
> > > your fields nicely and reuse it across mappings
> > > 
> > > Alex
> > > 
> > > On Wednesday, March 20, 2013 4:37:09 AM UTC-4, Pat wrote:
> > > 
> > > > Can you give me an example how this can be achieved with multifield?
> > > > 
> > > > Am Dienstag, 19. März 2013 18:51:45 UTC+1 schrieb AlexR:
> > > > 
> > > > > for this and other (such as indexing aggregated fields several times  
> > > > > say normal, stemmed, shingled) reasons it would be nice to be able to  
> > > > > establish an aggregation chain where aggergated (via multi\_field) fields  
> > > > > would be able to feed into other aggregated fields  
> > > > > it can be achieved with current multifield but at a cost of a highly  
> > > > > redundant mapping. while having such redundant mapping may not be a big  
> > > > > deal for schemas with few fields it is a very big deal for schemas with  
> > > > > hundreds of fields
> > > > > 
> > > > > On Tuesday, March 19, 2013 9:04:53 AM UTC-4, Pat wrote:
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > probably this question has been asked before, but I couldn't find an  
> > > > > > appropriate answer. I have a document structure like this  
> > > > > > {  
> > > > > > "broadcast": {  
> > > > > > "type": "nested",  
> > > > > > "properties": {  
> > > > > > "date": { "type": "date" },  
> > > > > > "duration": { "type": "long" },  
> > > > > > "title": { "type": "string" }  
> > > > > > }  
> > > > > > }  
> > > > > > }  
> > > > > > and I want to query "broadcast" including all subfields. We currently  
> > > > > > use Oracle Text, where I can simply query the "broadcast" field and all  
> > > > > > subfields are automatically included. I need to migrate to ES for several  
> > > > > > reasons and I need to make subfield searching available again.  
> > > > > > I already tried different approaches:
> > > > > > 
> > > > > > 1. Using a "multi\_match" query with wildcards ( "fields" :  
> > > > > > ["broadcast.\*"] ). This doesn't seem to work (the query returns an error)  
> > > > > > since the subfields have different types. I know that searching for a  
> > > > > > string in a date field doesn't seem to make much sense, but in Oracle Text  
> > > > > > you can get a match for a date if you search for a string like "2000-01-01".
> > > > > > 2. Using "include\_in\_parent". I was hoping that the values of the  
> > > > > > subfields are included in the parent field.
> > > > > > 3. Using "multi\_field" type. I could copy all values to a  
> > > > > > different field, but not to the parent field.
> > > > > > 
> > > > > > I heard that SOLR has a copyfield function, which would be a solution  
> > > > > > to my problem. I cannot use SOLR since I need nested objects to avoid cross  
> > > > > > object matches. I often read that one can achieve the same functionality in  
> > > > > > ES, but I couldn't find a solution to my problem.
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to a topic in the  
> > > > > Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit  
> > > > > [https://groups.google.com/d/topic/elasticsearch/uM2okz3IEZo/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/uM2okz3IEZo/unsubscribe?hl=en-US)  
> > > > > .  
> > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [March 22, 2013, 10:35am UTC](https://discuss.elastic.co/t/search-all-subfields/11206/9 "2013-03-22T10:35:30Z")

</div>

You can already define your own \_all fields. I demonstrated how to do it  
on stackoverflow in this answer:

> <https://stackoverflow.com/questions/15423033/multi-field-multi-word-match-without-query-string/15430238#15430238>

clint

On Fri, Mar 22, 2013 at 9:27 AM, Pat [elasticsearch@hushmail.com](mailto:elasticsearch@hushmail.com) wrote:

> I am wondering about the way the \_all field is implemented in ES. Since  
> you can decide if a field should be included in \_all or not, it seems to me  
> there is a kind of "copy field" working behind the scenes. Would it be that  
> difficult to extend ES so that you can define multiple "\_all" fields, each  
> including different fields?
> 
> Am Mittwoch, 20. März 2013 16:24:48 UTC+1 schrieb AlexR:
> 
> > yeah and besides rolling up your composite fields there is another  
> > aspect. You often want to index the same field several times using  
> > different analysis - say normal, stemmed and shingled and even with one big  
> > composite field like built in \_all you have to do your multifield mapping 3  
> > times for each flavor of your indexing. now add to it your roll up and you  
> > will end up with 3 times number of multifield mappings your roll up alone  
> > will need (and it may a dozens if you have fairly big and deeply nested  
> > json)
> > 
> > On Wed, Mar 20, 2013 at 11:19 AM, Pat [elasti...@hushmail.com](mailto:elasti...@hushmail.com) wrote:
> > 
> > > Ok, i get what you mean. Actually I am already trying to extend my  
> > > mapping this way and exactly like you said, this is enormous and error  
> > > prone...
> > > 
> > > Am Mittwoch, 20. März 2013 16:03:34 UTC+1 schrieb AlexR:
> > > 
> > > > Pat,
> > > > 
> > > > It is what you have been doing with multifields say you have abcd field  
> > > > which consists of ab and cd fields and those consist of a,b and c,d  
> > > > properties of your json. when you map a you would have it mapped to both ab  
> > > > and abcd same for b,c and d. I think it should work but with deep and wide  
> > > > hierarchy it will quickly become enormous and error prone. I wish there  
> > > > were a way to tell that abcd consists of ab and cd then you can roll up  
> > > > your fields nicely and reuse it across mappings
> > > > 
> > > > Alex
> > > > 
> > > > On Wednesday, March 20, 2013 4:37:09 AM UTC-4, Pat wrote:
> > > > 
> > > > > Can you give me an example how this can be achieved with multifield?
> > > > > 
> > > > > Am Dienstag, 19. März 2013 18:51:45 UTC+1 schrieb AlexR:
> > > > > 
> > > > > > for this and other (such as indexing aggregated fields several times  
> > > > > > say normal, stemmed, shingled) reasons it would be nice to be able to  
> > > > > > establish an aggregation chain where aggergated (via multi\_field) fields  
> > > > > > would be able to feed into other aggregated fields  
> > > > > > it can be achieved with current multifield but at a cost of a highly  
> > > > > > redundant mapping. while having such redundant mapping may not be a big  
> > > > > > deal for schemas with few fields it is a very big deal for schemas with  
> > > > > > hundreds of fields
> > > > > > 
> > > > > > On Tuesday, March 19, 2013 9:04:53 AM UTC-4, Pat wrote:
> > > > > > 
> > > > > > > Hi,
> > > > > > > 
> > > > > > > probably this question has been asked before, but I couldn't find an  
> > > > > > > appropriate answer. I have a document structure like this  
> > > > > > > {  
> > > > > > > "broadcast": {  
> > > > > > > "type": "nested",  
> > > > > > > "properties": {  
> > > > > > > "date": { "type": "date" },  
> > > > > > > "duration": { "type": "long" },  
> > > > > > > "title": { "type": "string" }  
> > > > > > > }  
> > > > > > > }  
> > > > > > > }  
> > > > > > > and I want to query "broadcast" including all subfields. We  
> > > > > > > currently use Oracle Text, where I can simply query the "broadcast" field  
> > > > > > > and all subfields are automatically included. I need to migrate to ES for  
> > > > > > > several reasons and I need to make subfield searching available again.  
> > > > > > > I already tried different approaches:
> > > > > > > 
> > > > > > > 1. Using a "multi\_match" query with wildcards ( "fields" :  
> > > > > > > ["broadcast.\*"] ). This doesn't seem to work (the query returns an error)  
> > > > > > > since the subfields have different types. I know that searching for a  
> > > > > > > string in a date field doesn't seem to make much sense, but in Oracle Text  
> > > > > > > you can get a match for a date if you search for a string like "2000-01-01".
> > > > > > > 2. Using "include\_in\_parent". I was hoping that the values of  
> > > > > > > the subfields are included in the parent field.
> > > > > > > 3. Using "multi\_field" type. I could copy all values to a  
> > > > > > > different field, but not to the parent field.
> > > > > > > 
> > > > > > > I heard that SOLR has a copyfield function, which would be a  
> > > > > > > solution to my problem. I cannot use SOLR since I need nested objects to  
> > > > > > > avoid cross object matches. I often read that one can achieve the same  
> > > > > > > functionality in ES, but I couldn't find a solution to my problem.
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to a topic in the  
> > > > > > Google Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this topic, visit [https://groups.google.com/d/](https://groups.google.com/d/)\*\*  
> > > > > > topic/elasticsearch/\*\*uM2okz3IEZo/unsubscribe?hl=en-\*\*US[https://groups.google.com/d/topic/elasticsearch/uM2okz3IEZo/unsubscribe?hl=en-US](https://groups.google.com/d/topic/elasticsearch/uM2okz3IEZo/unsubscribe?hl=en-US)  
> > > > > > .  
> > > > > > To unsubscribe from this group and all its topics, send an email to  
> > > > > > elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > > 
> > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > .
> > 
> > --  
> > 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).

--  
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:45am UTC](https://discuss.elastic.co/t/search-all-subfields/11206/10 "2017-07-06T02:45:08Z")

</div>


