Question on searching in a custom generated field


(Amit Soni) #1

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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #2