| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 | [[mapping-all-field]]=== `_all`The idea of the `_all` field is that it includes the text of one or moreother fields within the document indexed. It can come very handyespecially for search requests, where we want to execute a search queryagainst the content of a document, without knowing which fields tosearch on. This comes at the expense of CPU cycles and index size.The `_all` fields can be completely disabled. Explicit field mappings andobject mappings can be excluded / included in the `_all` field. Bydefault, it is enabled and all fields are included in it for ease ofuse.When disabling the `_all` field, it is a good practice to set`index.query.default_field` to a different value (for example, if youhave a main "message" field in your data, set it to `message`).One of the nice features of the `_all` field is that it takes intoaccount specific fields boost levels. Meaning that if a title field isboosted more than content, the title (part) in the `_all` field willmean more than the content (part) in the `_all` field.Here is a sample mapping:[source,js]--------------------------------------------------{    "person" : {        "_all" : {"enabled" : true},        "properties" : {            "name" : {                "type" : "object",                "dynamic" : false,                "properties" : {                    "first" : {"type" : "string", "store" : true , "include_in_all" : false},                    "last" : {"type" : "string", "index" : "not_analyzed"}                }            },            "address" : {                "type" : "object",                "include_in_all" : false,                "properties" : {                    "first" : {                        "properties" : {                            "location" : {"type" : "string", "store" : true}                        }                    },                    "last" : {                        "properties" : {                            "location" : {"type" : "string"}                        }                    }                }            },            "simple1" : {"type" : "long", "include_in_all" : true},            "simple2" : {"type" : "long", "include_in_all" : false}        }    }}--------------------------------------------------The `_all` fields allows for `store`, `term_vector` and `analyzer` (withspecific `analyzer` and `search_analyzer`) to be set.[float][[highlighting]]==== HighlightingFor any field to allow<<search-request-highlighting,highlighting>> it hasto be either stored or part of the `_source` field. By default the `_all`field does not qualify for either, so highlighting for it does not yieldany data.Although it is possible to `store` the `_all` field, it is basically anaggregation of all fields, which means more data will be stored, andhighlighting it might produce strange results.
 |