Nested object - include_in_parent vs include_in_root


(chocoheim) #1

[mapping]

  1. include_in_parent
    ...
    "WORD" :{
    "type" : "nested",
    "include_in_parent" : true,
    "properties":{
    "KEYWORD" :{"type":"string", "index": "not_analyzed", "omit_norms" :true, "index_options":"docs"},
    "POS" : {"type":"string", "index": "not_analyzed", "omit_norms" :true, "index_options":"docs"},
    "FREQ" : {"type":"integer", "store":"yes"}
    }
    },
    ...

  2. include_in_root
    ...
    "WORD" :{
    "type" : "nested",
    "include_in_root" : true,
    "properties":{
    "KEYWORD" :{"type":"string", "index": "not_analyzed", "omit_norms" :true, "index_options":"docs", "include_in_all" : false},
    "POS" : {"type":"string", "index" : "no"},
    "FREQ" : {"type":"integer", "store":"yes", "include_in_all" : false}
    }
    },
    ...

[query]
{
"size" : 0,
"query" : {
"bool" : {
"must" : [ {
"query_string" : {
"query" : "(apple AND notebook)",
"fields" : [ "WORD.KEYWORD" ],
"default_operator" : "and"
}
}, {
"range" : {
"POST_DATE" : {
"from" : "2013-12-31T15:00:00.000Z",
"to" : "2014-01-01T14:59:59.000Z",
"include_lower" : true,
"include_upper" : true
}
}
} ]
}
},
"facets" : {
"compoundNouns" : {
"terms_stats" : {
"key_field" : "WORD.KEYWORD",
"value_field" : "WORD.FREQ",
"size" : 2147483647
},
"nested" : "WORD"
}
}
}

question : why mapping 2(include_in_root) is faster than mapping 1(include_in_parent)?


(system) #2