Merge pull request #19150 from jimferenczi/id_field_docs

Fix docs example for the _id field, the field is not accessible in scripts
This commit is contained in:
Jim Ferenczi 2016-06-29 15:30:41 +02:00 committed by GitHub
commit 12282e00aa
1 changed files with 2 additions and 11 deletions

View File

@ -7,8 +7,8 @@ indexed as its value can be derived automatically from the
<<mapping-uid-field,`_uid`>> field. <<mapping-uid-field,`_uid`>> field.
The value of the `_id` field is accessible in certain queries (`term`, The value of the `_id` field is accessible in certain queries (`term`,
`terms`, `match`, `query_string`, `simple_query_string`) and scripts, but `terms`, `match`, `query_string`, `simple_query_string`), but
_not_ in aggregations or when sorting, where the <<mapping-uid-field,`_uid`>> _not_ in aggregations, scripts or when sorting, where the <<mapping-uid-field,`_uid`>>
field should be used instead: field should be used instead:
[source,js] [source,js]
@ -30,18 +30,9 @@ GET my_index/_search
"terms": { "terms": {
"_id": [ "1", "2" ] <1> "_id": [ "1", "2" ] <1>
} }
},
"script_fields": {
"UID": {
"script": {
"lang": "painless",
"inline": "doc['_id']" <2>
}
}
} }
} }
-------------------------- --------------------------
// CONSOLE // CONSOLE
<1> Querying on the `_id` field (also see the <<query-dsl-ids-query,`ids` query>>) <1> Querying on the `_id` field (also see the <<query-dsl-ids-query,`ids` query>>)
<2> Accessing the `_id` field in scripts