Commit graph

649 commits

Author SHA1 Message Date
Adrien Grand
52a0eca8c4
Add match_only_text, a space-efficient variant of text. (#72064)
This adds a new `match_only_text` field, which indexes the same data as a `text`
field that has `index_options: docs` and `norms: false` and uses the `_source`
for positional queries like `match_phrase`. Unlike `text`, this field doesn't
support scoring.
2021-04-22 14:47:54 +02:00
Adam Locke
0e324d7723
[DOCS] [7.x] Focus retrieving selected fields on fields parameter (#71979)
* [DOCS] Focus retrieving selected fields on fields parameter (#71506)

* Incorporating changes from reviews

* Adding clarifications from review feedback

* Slight wording revisions.

* Clarify language around format parameter and move text out of callout.

* Fix code block start tagging
2021-04-20 15:45:45 -04:00
Mayya Sharipova
86b6d22fe5 Add doc on rank_feature(s) negative score impact (#71795)
Add a warning about consequences of negative score impact
for documents that don't have values for rank_feature(s)
fields.

Related to #69994
2021-04-20 06:59:13 -04:00
Luca Cavanna
827b9ef194
Rename on_script_error options to fail or continue (#71841)
As we started thinking about applying on_script_error to runtime fields, to handle script errors at search time, we would like to use the same parameter that was recently introduced for indexed fields. We decided that continue or fail gives a better indication of the behaviour compared to the current ignore or reject which is too specific to indexing documents.

This commit applies such rename.
2021-04-20 11:35:34 +02:00
Alan Woodward
bcf7669e52 Add index-time scripts to geo_point field mapper (#71861)
This commit adds the ability to define an index-time geo_point field
with a script parameter, allowing you to calculate points from other
values within the indexed document.
2021-04-20 10:25:08 +01:00
Mayya Sharipova
d53e83c3c4
Add access to dense_vector values (#71847)
Allow direct access to a dense_vector' values in script
through the following functions:

- getVectorValue – returns a vector's value as an array of floats
- getMagnitude – returns a vector's magnitude

Closes #51964
Backport for #71313
2021-04-19 12:44:27 -04:00
Christoph Büscher
35c67305d4
Support fetching flattened subfields (#70916) (#71735)
Currently the `fields` API fetches the root flattened field and returns it in a
structured way in the response. In addition this change makes it possible to
directly query subfields. However, requesting flattened subfields via wildcard
patterns is not possible.

Closes #70605
2021-04-15 15:47:03 +02:00
Alan Woodward
34b13c2595 Add index-time scripts to date field mapper (#71633)
This commit allows you to set 'script' and 'on_script_error' parameters
on date field mappers, meaning that runtime date fields can be made indexed
simply by moving their definitions from the runtime section of the mappings
to the properties section.
2021-04-14 09:32:52 +01:00
Nik Everett
13a7f23ccf
Advise against dates with decimal points (#71578) (#71652)
We accept dates with a decimal point like `2113413.13241324` and parse
them *somehow*. But there are cases where we'll lose precision on those
dates, see #70085. This advises folks not to use that format. We'll
continue to accept those dates for backwards compatibility but you
should avoid using them.

Co-authored-by: Adrien Grand <jpountz@gmail.com>
2021-04-13 15:42:32 -04:00
Nik Everett
f1e5650a79
Convert parent-join example script to runtime field (backport of #71423) (#71631)
Runtime fields are much more flexible than script_fields because you
can filter and aggregate on them so we hope folks use them! This
converts the example of using a `parent_join` field in a script to a
runtime field so folks get used to seeing them and hopefully using them.

While I was editing this I took the opportunity to replace the script
with a real-ish example. Scripts that just load the field value are nice
and short but I hope no one uses them in real life because they just add
overhead when compared to accessing the field directly. So I made the
script do something.

Relates to #69291
2021-04-13 09:22:51 -04:00
Alan Woodward
5ad0001774 Add index-time scripts to IP field mapper (#71617)
This commit allows you to set 'script' and 'on_script_error' parameters
on IP field mappers, meaning that runtime IP fields can be made indexed
simply by moving their definitions from the runtime section of the mappings
to the properties section.
2021-04-13 13:56:53 +01:00
Nik Everett
db4911fa9f
Convert date_nanos example script to runtime field (backport of #71351) (#71594)
Runtime fields are much more flexible than script_fields because you
can filter and aggregate on them so we hope folks use them! This
converts the example of using a `date_nanos` field in a script to a
runtime field so folks get used to seeing them and hopefully using them.

While I was editing this I took the opportunity to replace the script
with a real-ish example. Scripts that just load the field value are nice
and short but I hope no one uses them in real life because they just add
overhead when compared to accessing the field directly. So I made the
script do something.

Relates to #69291

Co-authored-by: Adam Locke <adam.locke@elastic.co>
2021-04-12 18:12:42 -04:00
Alan Woodward
3268d449c9 Add scripts to keyword field mapper (#71555)
This commit adds script and on_script_error parameters to
keyword field mappers, allowing you to define index-time scripts
for keyword fields.
2021-04-12 16:58:51 +01:00
Luca Cavanna
29a875f693
Add support for script parameter to boolean field mapper (#71454)
Relates to #68984
2021-04-12 11:53:50 +02:00
Nhat Nguyen
5913b79dd3
Allow specify dynamic templates in bulk request (#71518)
This change allows users to specify dynamic templates in a bulk request.

```
PUT myindex
{
  "mappings": {
    "dynamic_templates": [{
      "time_histograms": {
        "mapping": {
          "type": "histogram",
          "meta": {
            "unit": "s"
          }
        }
      }
    }]
  }
}
```

```
POST myindex/_bulk
{ "index": { "dynamic_templates": { "response_times": "time_histograms" } } }
{ "@timestamp": "2020-08-12", "response_times": { "values": [1, 10], "counts": [5, 1] }}
```

Closes #61939
2021-04-10 10:14:11 -04:00
Julie Tibshirani
4205b04173 Support fetching _tier field value (#71379)
Now that the `fields` option allows fetching metadata fields, we can support
loading the new `_tier` metadata field.

Relates to #63569 and #68135.
2021-04-08 12:57:48 -07:00
Adam Locke
d0d5376e03
[DOCS] [7.x] Adding page for indexing runtime fields #71366 (#71431)
* [DOCS] Adding page for indexing runtime fields (#71366)

* [DOCS] Adding page for indexing runtime fields

* Fixing tests.

* Incorporating review feedback to enhance and improve examples.

* Changing note to indicate immutable script when indexing, plus adding on_script_error.

* Add type to responses for 7.x
2021-04-07 13:32:33 -04:00
markharwood
754cda81bc
New queryable "_tier" metadata field (#69288) (#71123)
* New _tier metadata field that supports term, terms, exists and wildcard queries on the first data tier preference stated for an index.

Backport of 3aee4c1f1f

Closes #68135
2021-04-07 15:44:32 +01:00
Nik Everett
5964825f88
Convert boolean field example to runtime fields (backport of #71341) (#71364)
Runtime fields are much more flexible than `script_fields` because you
can filter and aggregate on them so we hope folks use them! This
converts the example of using a `boolean` field in a script to a runtime
field so folks get used to seeing them and hopefully using them.

While I was editing this I took the opportunity to replace the script
with a real-ish example. Scripts that just load the field value are nice
and short but I hope no one uses them in real life because they just add
overhead when compared to accessing the field directly. So I made the
script do *something*.

Relates to #69291
2021-04-06 15:09:23 -04:00
Alan Woodward
729fbbb7cd Add note that scripted fields will reject documents with a source value in their field (#71340) 2021-04-06 14:30:47 +01:00
Adam Locke
ba8e0ac105
[DOCS] Expand examples for runtime fields in a search query (#71237) (#71256)
* Add warning admonition for removing runtime fields.

* Add cross-link to runtime fields.

* Expanding examples for runtime fields in a search request.

* Clarifying language and simplifying response tests.
2021-04-02 15:26:39 -04:00
James Rodewig
c757f9e4e7
[DOCS] Fix double spaces (#71082) (#71120) 2021-03-31 11:43:34 -04:00
Alan Woodward
e3b3bd20a4
Add script parameter to long and double field mappers (#69531) (#71105)
This commit adds a script parameter to long and double fields that makes
it possible to calculate a value for these fields at index time. It uses the same
script context as the equivalent runtime fields, and allows for multiple index-time
scripted fields to cross-refer while still checking for indirection loops.
2021-03-31 15:28:47 +01:00
markharwood
1575ca01a0
Search - make wildcard field use constant scoring queries for wildcard queries and caching fix (#70452) (#71043)
Backport of 2f9c731
* Make wildcard field use constant scoring queries for wildcard queries. Add a note about ignoring rewrite parameters on wildcard queries.

Also fixes caching issue where case sensitive and case insensitive results were cached as the same

Closes #69604
2021-03-30 12:57:08 +01:00
Jim Ferenczi
149fab64d7
Change default format for date_nanos field (#70463) (#70488)
This commit updates the default format of date_nanos field
on existing and new indices to use `strict_date_optional_time_nanos` instead of
`strict_date_optional_time`.
Using `strict_date_optional_time` as the default format for date_nanos doesn't
make sense because it accepts and parses dates with nanosecond precision,
but when it formats it drops the nanoseconds.
The change should be transparent for users, these formats accept the same input.

Relates #69192
Closes #67063
2021-03-18 16:31:52 +01:00
James Rodewig
62d6ac3ba5
[DOCs] Add tip for index_options parameter (#70450) (#70499)
Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>

Co-authored-by: yudidi <972656027@qq.com>
2021-03-17 10:43:50 -04:00
jimczi
6ad67113f0 Revert "Change default format for date_nanos field (#70463)"
This reverts commit 3bf973ae0e.
2021-03-17 12:54:43 +01:00
Jim Ferenczi
3bf973ae0e Change default format for date_nanos field (#70463)
This commit updates the default format of date_nanos field
on existing and new indices to use `strict_date_optional_time_nanos` instead of
`strict_date_optional_time`.
Using `strict_date_optional_time` as the default format for date_nanos doesn't
make sense because it accepts and parses dates with nanosecond precision,
but when it formats it drops the nanoseconds.
The change should be transparent for users, these formats accept the same input.

Relates #69192
Closes #67063
2021-03-17 12:14:24 +01:00
James Rodewig
302341a526
[DOCS] Replace put with create or update in API names (#70330) (#70421)
Co-authored-by: debadair <debadair@elastic.co>
Co-authored-by: Lisa Cawley <lcawley@elastic.co>
2021-03-15 17:16:13 -04:00
Julie Tibshirani
13946ea7e2
Move flattened field to core. (#70122)
This field mapper only lived in its own module so it could be licensed as x-pack
basic. Now it can be moved to core, which matches its status as a core type.

The PR also removes flattened fields from xpack usage stats now that they live
in core. The usage stats were already removed in on master, but this PR was not
backported to avoid a breaking change on 7.x. We have now clarified that usage
stats updates are not considered breaking, so it is safe to backport this
change.
2021-03-11 11:23:28 -08:00
Mayya Sharipova
f7cb422b86
Add positive_score_impact to rank_features type (#70277)
rank_features field type misses positive_score_impact parameter
that rank_feature type has. This adds this parameter.

Backport for #69994
Closes #68619
2021-03-11 06:50:36 -05:00
James Rodewig
5ae19ee8c6
[DOCS] Add guidance for mapping unstructured content (#69079) (#70098) 2021-03-08 13:14:42 -05:00
Mayya Sharipova
32c8bc4538 Remove size of dense_vector (#70024)
Remove not completely correct statement about the size of dense_vectors

We do store a dense_vector as binary doc value  with size `4*dims+4`.
But this is size before compression. As compressed size depends on
data itself, it is better to remove completely any statement
about the size.
2021-03-08 09:30:48 -05:00
Christoph Büscher
050cc41009 [DOCS] Improve tip about updating search_analyzer (#69621)
The tip about updating a `search_analyzer` currently does not mention that most
of the time (when the current analyzer is not "default"), user need to repeat
the currently set "analyzer" parameter in the field definition. Adding this as a
short note.
2021-03-03 16:32:36 +01:00
Nik Everett
bd4e059746 Docs: Call out that you can't update analyzer (#69889)
You can't update the `analyzer` parameter in the PUT mappings API even if
the index is closed. This adds a TIP to call that out. And adds a TIP
for `search_quote_analyzer` which you *can* update.
2021-03-03 10:33:24 -05:00
Adam Locke
55ada03040
[DOCS] [7.x] Remove beta admonition for runtime fields. (#69562) 2021-02-24 11:55:15 -05:00
Adam Locke
85d279440d
[DOCS] [7.x] Adding grok support for runtime fields. (#69308) (#69473)
* [DOCS] [7.x] Adding grok support for runtime fields. (#69308)

* [DOCS] Adding grok support for runtime fields.

* Update response.

* Adding testresponse replacements.

* Update runtime field context and add dissect.

* Fixing backslash in the response.

* Fixing testresponse.

* Incorporating review feedback.

* Updates emit and adds cross link from ES runtime fields page.

* Add missing _type to response.
2021-02-23 14:25:03 -05:00
James Rodewig
45d93d9458
[DOCS] Remove added admons (#69452) (#69454) 2021-02-23 10:48:36 -05:00
James Rodewig
08b2136d78
[DOCS] Use consistent @timestamp field name (#69435) (#69449)
Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>

Co-authored-by: Koji Kawamura <ijokarumawak@users.noreply.github.com>
2021-02-23 10:20:23 -05:00
James Rodewig
8e991932b8
[DOCS] Improve docs for geo_shape field type's circle type (#69285) (#69361) 2021-02-22 10:36:41 -05:00
Adam Locke
7a2b326147
[DOCS] Relocate scriptless runtime document (#68916) (#69144)
* Reallocate runtime document

Reallocate document `runtime-fields-scriptless` from `runtime-search-request` to `runtime-mapping-fields`

* Move runtime without script section

Move runtime without script section to under the dynamic runtime mapping section

* Fix snippet formatting and remove discrete heading.

* Update test snippet.

Co-authored-by: Adam Locke <adam.locke@elastic.co>

Co-authored-by: S. J. Lee <occidere@naver.com>
2021-02-17 13:16:48 -05:00
James Rodewig
b55249507e
[DOCS] Fix typos for duplicate words (#69125) (#69132) 2021-02-17 11:16:58 -05:00
Luca Cavanna
4c19f6096f
Add the ability to remove a runtime field (backport of #68992) (#69080)
Currently, existing runtime fields can be updated, but they cannot be removed. That allows to correct potential mistakes, but once a runtime field is added to the index mappings, it is not possible to remove it.

With this commit we introduce the ability to remove an existing runtime field by providing a null value for it through the put mapping API. If a field with such name does not exist, such specific instruction will have no effect on other existing runtime fields.

Note that the removal of runtime fields makes the recently introduced assertRefreshItNotNeeded assertion trip, because when each local node merges mappings back in, the runtime fields that were previously removed by the master node, get added back again locally. This is only a problem for the assertion that verifies that the removed refresh operation is never needed. We worked around this by tweaking the assertion to ignore runtime fields completely, for simplicity, by assertion on the serialized merged mappings and incoming mappings without the corresponding runtime section.

Co-authored-by: Adam Locke <adam.locke@elastic.co>
2021-02-16 17:30:31 -05:00
James Rodewig
bb86f8ed7b
[DOCS] Document what makes a geo-point malformed (#59045) (#68557)
Co-authored-by: Ben Moskovitz <ben@mosk.nz>
2021-02-04 17:02:37 -05:00
Adam Locke
3185363400
[DOCS] Add beta admonition for runtime fields. (#67847) (#67849)
* Add beta admonition for runtime fields.

* Add beta admonition to search your data page.
2021-01-21 18:03:45 -05:00
Adam Locke
be307cfad1
[DOCS] [7.x] Add runtime fields to Painless Guide (#67781) (#67844)
* Adding runtime fields page for Painless context.

* Adds beta admonition to runtime fields and Painless docs.

* Fixing test errors and improving content sections.

* Adding refresh to fix test cases.

* Simplifying the ingest request to include refresh.

* Removing beta (will add in another PR) and updating examples.
2021-01-21 16:26:07 -05:00
Adam Locke
95e3810d15
[DOCS] [7.x] Updates to the runtime fields docs for 7.11+ (#67484) (#67711)
* [DOCS] [7.x] Updates to the runtime fields docs for 7.11+ (#67484)

* Moving examples to the page for retrieving runtime fields.

* Adding runtime_mappings to request body of search API.

* Updating runtime_mappings properties and adding runtime fields to search your data.

* Updating examples and hopefully fixing build failure.

* Fixing snippet formatting that was causing test failure.

* Adding page in Painless guide for runtime fields.

* Fixing typo.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

* Fixing testresponse to include _type.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-01-19 12:50:19 -05:00
James Rodewig
24f8a798f8
[DOCS] Add doc values restriction for wildcard fields (#67503) (#67513)
Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>

Co-authored-by: AndyHunt66 <andrew.hunt@elastic.co>
2021-01-14 09:39:43 -05:00
Adam Locke
33caf15832
[DOCS] [7.x] Updating dynamic mappings for runtime fields (#67301) (#67368)
* [DOCS] [7.x] Updating dynamic mappings for runtime fields (#67301)

* Updating dynamic mappings for runtime fields.

* Updating example to fix test case and be more accurate.

* Changing header level for dynamic runtime.

* Clarifying language around ip fields in dynamic template.

* Adding test warning to fix snippet test.
2021-01-12 12:59:55 -05:00
James Rodewig
3872f08b33
[DOCS] Clean up index template xrefs (#67264) (#67272) 2021-01-11 12:58:00 -05:00