# Question on searching in a custom generated field

**URL:** <https://discuss.elastic.co/t/question-on-searching-in-a-custom-generated-field/14220>\
**Category:** Elasticsearch\
**Created:** [November 1, 2013, 5:05pm UTC](https://discuss.elastic.co/t/question-on-searching-in-a-custom-generated-field/14220 "2013-11-01T17:05:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit\_Soni](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Amit\_Soni](https://discuss.elastic.co/u/Amit_Soni)\
**Post date:** [November 1, 2013, 5:05pm UTC](https://discuss.elastic.co/t/question-on-searching-in-a-custom-generated-field/14220/1 "2013-11-01T17:05:51Z")

</div>

Hi all - I am trying to implement a search in which I want to perform  
search over a few pre-defined fields and I do not want to specify those  
fields in my query every time (since the request size might become big). In  
order to do this, I can think of two options:  
\*  
\*  
_Option 1_: Set "include\_in\_all" on the fields that I want to include in  
"\_all" and then execute my search over "\_all' field. The problem I see in  
this approach is I have no control how each of the fields are getting  
analyzed when they merge into "\_all". My understanding is that the entire  
"\_all" field has just one way of analysis and I cannot control analysis of  
components which comprised "\_all"

"phone": {  
"type": "string",  
"include\_in\_all": true //Okay, but how do I control  
analysis when it gets included in \_all  
}  
\*  
Option 2\*: This is where I can create a totally new multi\_field and then  
specify how each of the entities, that would go in this new field will get  
analyzed.

"phone" : {  
"type" : "multi\_field",

```
        "fields" : {
            "phone" : {"type" : "string", "index" : "not_analyzed"},

            "*my_composite_field*" : {"type" : "string", "index" :

```

"analyzed"}

```
        }
    },

```

"fixedLine" : {

```
        "type" : "multi_field",
        "fields" : {

            "fixedLine" : {"type" : "string", "index" : "not_analyzed"},

            "*my_composite_field*" : {"type" : "string", "index" :

```

"analyzed"}

```
        }
    }

```

I believe here that "_my\_composite\_field_" will contain _both_ fixedLine  
and phone values in a way that I want them to be analyzed. Is that right?

-Amit.

--  
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:09am UTC](https://discuss.elastic.co/t/question-on-searching-in-a-custom-generated-field/14220/2 "2017-07-06T02:09:17Z")

</div>


