Skip to content

_all field #63

@kimchy

Description

@kimchy

Support _all field. The idea of an _all field is a field that includes the text of one or more other fields within the document indexed. It can come very handy especially for search request, where we want to execute a search query against the content of a document, without knowing which fields to search on. This comes at the expense of CPU cycles and index size.

The all fields can be completely disabled. Explicit field mapping and object mapping can be excluded / included in the all field. By default, all field is enabled and all fields are included in it for ease of use.

One of the nice features of the all field is that it takes into account specific fields boost levels. Meaning that if a title field is boosted more than content, the title (part) in the _all field will mean more than the content part in the all field.

With the _all field, certain APIs that require fields to be set can be simplified. They include:

  • The queryString query defaultField now defaults to the _all field.
  • The terms API fields now default to the _all field and not required.
  • More Like This query fields now default to _all if not set.

Here is a sample mapping:

{ person : { allField : {enabled : true}, properties : { name : { type : "object", dynamic : false, properties : { first : {type : "string", store : "yes", includeInAll : false}, last : {type : "string", index : "not_analyzed"} } }, address : { type : "object", includeInAll : false, properties : { first : { properties : { location : {type : "string", store : "yes", indexName : "firstLocation"} } }, last : { properties : { location : {type : "string"} } } } }, simple1 : {type : "long", includeInAll : true}, simple2 : {type : "long", includeInAll : false} } } } 

The allField mapping can also be associated with an analyzer (index/search), a termVector, and the ability to store it (the concatenated text).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions