Skip to content

Commit

Permalink
Docs: Mapping docs completely rewritten for 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
clintongormley committed Aug 6, 2015
1 parent 40cd460 commit ac2b895
Show file tree
Hide file tree
Showing 87 changed files with 4,760 additions and 2,433 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ docs/html/
docs/build.log
/tmp/
backwards/

html_docs
## eclipse ignores (use 'mvn eclipse:eclipse' to build eclipse projects)
## All files (.project, .classpath, .settings/*) should be generated through Maven which
## will correctly set the classpath based on the declared dependencies and write settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Response:
}
--------------------------------------------------

The specified field must be of type `geo_point` (which can only be set explicitly in the mappings). And it can also hold an array of `geo_point` fields, in which case all will be taken into account during aggregation. The origin point can accept all formats supported by the `geo_point` <<mapping-geo-point-type,type>>:
The specified field must be of type `geo_point` (which can only be set explicitly in the mappings). And it can also hold an array of `geo_point` fields, in which case all will be taken into account during aggregation. The origin point can accept all formats supported by the <<geo-point,`geo_point` type>>:

* Object format: `{ "lat" : 52.3760, "lon" : 4.894 }` - this is the safest format as it is the most explicit about the `lat` & `lon` values
* String format: `"52.3760, 4.894"` - where the first number is the `lat` and the second is the `lon`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ and therefore can't be used in the `order` option of the `terms` aggregator.
If the `top_hits` aggregator is wrapped in a `nested` or `reverse_nested` aggregator then nested hits are being returned.
Nested hits are in a sense hidden mini documents that are part of regular document where in the mapping a nested field type
has been configured. The `top_hits` aggregator has the ability to un-hide these documents if it is wrapped in a `nested`
or `reverse_nested` aggregator. Read more about nested in the <<mapping-nested-type,nested type mapping>>.
or `reverse_nested` aggregator. Read more about nested in the <<nested,nested type mapping>>.

If nested type has been configured a single document is actually indexed as multiple Lucene documents and they share
the same id. In order to determine the identity of a nested hit there is more needed than just the id, so that is why
Expand Down
37 changes: 33 additions & 4 deletions docs/reference/api-conventions.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,33 @@ being consumed by a monitoring tool, rather than intended for human
consumption. The default for the `human` flag is
`false`.

[[date-math]]
=== Date Math

Most parameters which accept a formatted date value -- such as `gt` and `lt`
in <<query-dsl-range-query,range queries>> `range` queries, or `from` and `to`
in <<search-aggregations-bucket-daterange-aggregation,`daterange`
aggregations>> -- understand date maths.

The expression starts with an anchor date, which can either be `now`, or a
date string ending with `||`. This anchor date can optionally be followed by
one or more maths expressions:

* `+1h` - add one hour
* `-1d` - subtract one day
* `/d` - round down to the nearest day

The supported <<time-units,time units>> are: `y` (year), `M` (month), `w` (week),
`d` (day), `h` (hour), `m` (minute), and `s` (second).

Some examples are:

[horizontal]
`now+1h`:: The current time plus one hour, with ms resolution.
`now+1h+1m`:: The current time plus one hour plus one minute, with ms resolution.
`now+1h/d`:: The current time plus one hour, rounded down to the nearest day.
`2015-01-01||+1M/d`:: `2015-01-01` plus one month, rounded down to the nearest day.

[float]
=== Response Filtering

Expand Down Expand Up @@ -237,10 +264,10 @@ curl 'localhost:9200/_segments?pretty&filter_path=indices.**.version'
--------------------------------------------------

Note that elasticsearch sometimes returns directly the raw value of a field,
like the `_source` field. If you want to filter _source fields, you should
like the `_source` field. If you want to filter `_source` fields, you should
consider combining the already existing `_source` parameter (see
<<get-source-filtering,Get API>> for more details) with the `filter_path`
parameter like this:
parameter like this:

[source,sh]
--------------------------------------------------
Expand Down Expand Up @@ -318,8 +345,9 @@ of supporting the native JSON number types.
[float]
=== Time units

Whenever durations need to be specified, eg for a `timeout` parameter, the duration
can be specified as a whole number representing time in milliseconds, or as a time value like `2d` for 2 days. The supported units are:
Whenever durations need to be specified, eg for a `timeout` parameter, the
duration must specify the unit, like `2d` for 2 days. The supported units
are:

[horizontal]
`y`:: Year
Expand All @@ -329,6 +357,7 @@ can be specified as a whole number representing time in milliseconds, or as a ti
`h`:: Hour
`m`:: Minute
`s`:: Second
`ms`:: Milli-second

[[distance-units]]
[float]
Expand Down
50 changes: 0 additions & 50 deletions docs/reference/index-modules/mapper.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,3 @@ added to an index either when creating it or by using the put mapping
api. It also handles the dynamic mapping support for types that have no
explicit mappings pre defined. For more information about mapping
definitions, check out the <<mapping,mapping section>>.

[float]
=== Dynamic Mappings

New types and new fields within types can be added dynamically just
by indexing a document. When Elasticsearch encounters a new type,
it creates the type using the `_default_` mapping (see below).

When it encounters a new field within a type, it autodetects the
datatype that the field contains and adds it to the type mapping
automatically.

See <<mapping-dynamic-mapping>> for details of how to control and
configure dynamic mapping.

[float]
=== Default Mapping

When a new type is created (at <<indices-create-index,index creation>> time,
using the <<indices-put-mapping,`put-mapping` API>> or just by indexing a
document into it), the type uses the `_default_` mapping as its basis. Any
mapping specified in the <<indices-create-index,`create-index`>> or
<<indices-put-mapping,`put-mapping`>> request override values set in the
`_default_` mapping.

The default mapping definition is a plain mapping definition that is
embedded within Elasticsearch:

[source,js]
--------------------------------------------------
{
_default_ : {
}
}
--------------------------------------------------

Pretty short, isn't it? Basically, everything is `_default_`ed, including the
dynamic nature of the root object mapping which allows new fields to be added
automatically.

The default mapping can be overridden by specifying the `_default_` type when
creating a new index.

[float]
=== Mapper settings

`index.mapper.dynamic` (_dynamic_)::

Dynamic creation of mappings for unmapped types can be completely
disabled by setting `index.mapper.dynamic` to `false`.
40 changes: 20 additions & 20 deletions docs/reference/index-modules/similarity.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ are scored. Similarity is per field, meaning that via the mapping one
can define a different similarity per field.

Configuring a custom similarity is considered a expert feature and the
builtin similarities are most likely sufficient as is described in the
<<mapping-core-types,mapping section>>
builtin similarities are most likely sufficient as is described in
<<similarity>>.

[float]
[[configuration]]
Expand Down Expand Up @@ -41,7 +41,7 @@ Here we configure the DFRSimilarity so it can be referenced as
"properties" : {
"title" : { "type" : "string", "similarity" : "my_similarity" }
}
}
}
--------------------------------------------------

[float]
Expand All @@ -52,9 +52,9 @@ Here we configure the DFRSimilarity so it can be referenced as
==== Default similarity

The default similarity that is based on the TF/IDF model. This
similarity has the following option:
similarity has the following option:

`discount_overlaps`::
`discount_overlaps`::
Determines whether overlap tokens (Tokens with
0 position increment) are ignored when computing norm. By default this
is true, meaning overlap tokens do not count when computing norms.
Expand All @@ -71,14 +71,14 @@ http://en.wikipedia.org/wiki/Okapi_BM25[Okapi_BM25] for more details.
This similarity has the following options:

[horizontal]
`k1`::
`k1`::
Controls non-linear term frequency normalization
(saturation).
(saturation).

`b`::
Controls to what degree document length normalizes tf values.
`b`::
Controls to what degree document length normalizes tf values.

`discount_overlaps`::
`discount_overlaps`::
Determines whether overlap tokens (Tokens with
0 position increment) are ignored when computing norm. By default this
is true, meaning overlap tokens do not count when computing norms.
Expand All @@ -90,17 +90,17 @@ Type name: `BM25`
==== DFR similarity

Similarity that implements the
http://lucene.apache.org/core/4_1_0/core/org/apache/lucene/search/similarities/DFRSimilarity.html[divergence
http://lucene.apache.org/core/5_2_1/core/org/apache/lucene/search/similarities/DFRSimilarity.html[divergence
from randomness] framework. This similarity has the following options:

[horizontal]
`basic_model`::
Possible values: `be`, `d`, `g`, `if`, `in`, `ine` and `p`.
`basic_model`::
Possible values: `be`, `d`, `g`, `if`, `in`, `ine` and `p`.

`after_effect`::
Possible values: `no`, `b` and `l`.
Possible values: `no`, `b` and `l`.

`normalization`::
`normalization`::
Possible values: `no`, `h1`, `h2`, `h3` and `z`.

All options but the first option need a normalization value.
Expand All @@ -111,12 +111,12 @@ Type name: `DFR`
[[ib]]
==== IB similarity.

http://lucene.apache.org/core/4_1_0/core/org/apache/lucene/search/similarities/IBSimilarity.html[Information
http://lucene.apache.org/core/5_2_1/core/org/apache/lucene/search/similarities/IBSimilarity.html[Information
based model] . This similarity has the following options:

[horizontal]
`distribution`:: Possible values: `ll` and `spl`.
`lambda`:: Possible values: `df` and `ttf`.
`distribution`:: Possible values: `ll` and `spl`.
`lambda`:: Possible values: `df` and `ttf`.
`normalization`:: Same as in `DFR` similarity.

Type name: `IB`
Expand All @@ -125,7 +125,7 @@ Type name: `IB`
[[lm_dirichlet]]
==== LM Dirichlet similarity.

http://lucene.apache.org/core/4_7_1/core/org/apache/lucene/search/similarities/LMDirichletSimilarity.html[LM
http://lucene.apache.org/core/5_2_1/core/org/apache/lucene/search/similarities/LMDirichletSimilarity.html[LM
Dirichlet similarity] . This similarity has the following options:

[horizontal]
Expand All @@ -137,7 +137,7 @@ Type name: `LMDirichlet`
[[lm_jelinek_mercer]]
==== LM Jelinek Mercer similarity.

http://lucene.apache.org/core/4_7_1/core/org/apache/lucene/search/similarities/LMJelinekMercerSimilarity.html[LM
http://lucene.apache.org/core/5_2_1/core/org/apache/lucene/search/similarities/LMJelinekMercerSimilarity.html[LM
Jelinek Mercer similarity] . This similarity has the following options:

[horizontal]
Expand Down
Loading

0 comments on commit ac2b895

Please sign in to comment.