Commit graph

3326 commits

Author SHA1 Message Date
Navarone Feekery
d40ff36a20
[Connectors API] Add missing _api_key_id docs (#106469) (#106539) 2024-03-20 07:28:09 -04:00
Benjamin Trent
f864083230
Fix bug when nested knn pre-filter might match nested docs (#105994) (#106021)
When using a pre-filter with nested kNN vectors, its treated like a
top-level filter. Meaning, it is applied over parent document fields. 

However, there are times when a query filter is applied that may or may
not match internal nested or non-nested docs. We failed to handle this
case correctly and users would receive an error.

closes: https://github.com/elastic/elasticsearch/issues/105901
2024-03-06 09:45:30 -05:00
Niels Bauman
ff920b5fe4
Update health YAML REST test skip version (#105927) (#105929)
The health report API changed names in
https://github.com/elastic/elasticsearch/pull/92879, which causes this
YAML REST test to fail in versions < 8.7.0.

Closes #105923
2024-03-04 14:15:33 -05:00
Niels Bauman
111b22108d
Make Health API more resilient to multi-version clusters (#105789) (#105903)
First check whether the full cluster supports a specific indicator (feature) before we mark an indicator as "unknown" when (meta) data is missing from the cluster state.
2024-03-04 09:03:13 -05:00
Lee Hinman
97fd8a7e39
Always show composed_of field for composable index templates (#105315) (#105572)
* Always show `composed_of` field for composable index templates

Prior to e786cfa706 we inadvertently always added composable index
templates with `composed_of: []` beacuse
e786cfa706 (diff-5081302eb39033199deb1977d544d1cd7867212a92b8d77e0aa0ded361272b11L618-L630)
created a new `ComposableIndexTemplate` from an existing one, and the `.composedOf()` field returned
an empty list of no component templates were provided:

89e714ee5d/server/src/main/java/org/elasticsearch/cluster/metadata/ComposableIndexTemplate.java (L172-L177)

This meant that before 8.12.0 we would always show `composed_of: []` for composable index templates.
This commit recreates this behavior, and always displays the empty list even if no component
templates are used by a composable index template.

Resolves #104627
2024-02-15 14:24:45 -05:00
Jedr Blaszyk
91e6fbc6d5
[Connector API] Add 8.13 docs (#105456) 2024-02-14 12:10:59 +01:00
Andrew Wilkins
5f90978296
Add unmatch_mapping_type, and support array of types (#103171)
Add an `unmatch_mapping_type` condition to dynamic templates (supporting
one or more types), and add support for specifying a list of types to
`match_mapping_type`.

Closes https://github.com/elastic/elasticsearch/issues/102795 Closes
https://github.com/elastic/elasticsearch/issues/102807
2024-02-09 10:42:26 -05:00
Michael Peterson
15ded61150
Reversing unintentional change to indices.resolve_index/10_basic_resolve_index.yml (#105300)
Was changed in #102726
2024-02-08 12:48:40 -05:00
Matteo Piergiovanni
54cfce4379
Flag in _field_caps to return only fields with values in index (#103651)
We are adding a query parameter to the field_caps api in order to filter out 
fields with no values. The parameter is called `include_empty_fields`  and 
defaults to true, and if set to false it will filter out from the field_caps 
response all the fields that has no value in the index.
We keep track of FieldInfos during refresh in order to know which field has 
value in an index. We added also a system property 
`es.field_caps_empty_fields_filter` in order to disable this feature if needed.

---------

Co-authored-by: Matthias Wilhelm <ankertal@gmail.com>
2024-02-08 17:52:21 +01:00
Michael Peterson
ac36aa7795
Resolve Cluster API (#102726)
To improve cross-cluster search user experience, Kibana needs an endpoint that is accessible
by arbitrary Kibana dashboard search users and provides:

1. a listing of clusters in scope for a CCS query (based on the index expression and whether 
there are any indices on each cluster that the Kibana user has access to query).
2. whether that cluster is currently connected to the querying cluster (will it come back as 
skipped or failed in a CCS search)
3. showing the skip_unavailable setting for those clusters (so you can know whether it will
return skipped or failed in a CCS search)
4. the ES version of the cluster

Since no single Elasticsearch endpoint provides all of these features, this PR creates a new endpoint `_resolve/cluster` that works along side the existing `_resolve/index` endpoint 
(and leverages some of its features).

Example usage against a cluster with 2 remote clusters configured:

GET /_resolve/cluster/*,remote*:bl*

Response:

{
  "(local)": {
    "connected": true,
    "skip_unavailable": false,
    "matching_indices": true,
    "version": {
      "number": "8.12.0-SNAPSHOT",
      "build_flavor": "default",
      "minimum_wire_compatibility_version": "7.17.0",
      "minimum_index_compatibility_version": "7.0.0"
    }
  },
  "remote2": {
    "connected": true,
    "skip_unavailable": true,
    "matching_indices": true,
    "version": {
      "number": "8.12.0-SNAPSHOT",
      "build_flavor": "default",
      "minimum_wire_compatibility_version": "7.17.0",
      "minimum_index_compatibility_version": "7.0.0"
    }
  },
  "remote1": {
    "connected": true,
    "skip_unavailable": false,
    "matching_indices": false,
    "version": {
      "number": "8.12.0-SNAPSHOT",
      "build_flavor": "default",
      "minimum_wire_compatibility_version": "7.17.0",
      "minimum_index_compatibility_version": "7.0.0"
    }
  }
}

Almost all errors show up as "error" entries in the response.
Only the local SecurityException returns a 403 since that happens before the ResolveCluster
Transport code kicks in.
2024-02-08 10:50:05 -05:00
Johannes Fredén
334aa1bc8d
Add support for fetching user profileId in Query Users (#104923)
Add support for fetching user profileId in Query Users
2024-02-07 08:49:39 +01:00
Jedr Blaszyk
24f9682b7d
[Connector API] Support filtering connectors by service type and a query (#105178) 2024-02-06 19:35:06 +01:00
David Kyle
5f325187cb
[ML] Make task_type optional (#104483)
Makes the task_type element of the _inference API optional so that 
it is possible to GET, DELETE or POST to an inference entity without
providing the task type
2024-02-06 16:15:24 +00:00
Navarone Feekery
14169c442e
[Connector Secrets] Add PUT endpoint for connector secrets (#105148) 2024-02-06 12:03:36 +01:00
Jan Kuipers
0977ba9f31
Fix link to test_grok_pattern api (#105174) 2024-02-06 04:11:11 -05:00
Benjamin Trent
43362d5de5
Add new int8_flat and flat vector index types (#104872)
This adds two new vector index types:  - flat   - int8_flat

Both store the vectors in a flat space and search is brute-force over
the vectors in the index.   For the regular `flat` index, this can be
considered syntactic sugar that allows `knn` queries without having to
put indices within HNSW. 

For `int8_flat`, this allows float vectors to be stored in a flat
manner, but also automatically quantized.
2024-02-05 12:56:13 -05:00
Martijn van Groningen
4376bdb2f1
Adjust skip version for tsdb bwc tests that rely on _id / _tsid (#105144)
Yaml tests executed in mixed clusters need to skip clusters that run 8.12.x or earlier versions. The yaml tests assume hashing based time series ids, but if a node in the test cluster is on 8.12.x or earlier, then it can happen pre hashing time series ids are used (depending on the version of the elected master node).

Tsdb yaml tests that assert the _id or _tsid should be skipped if there are 8.12.x nodes in the mixed test cluster.
Rolling upgrade or full upgrade tests are better for assertion the _id or _tsid in this case, because tests are setup prior to upgrade and pre 8.12.x logic can be asserted in a more controlled way.

Closes #105129
2024-02-05 18:08:08 +01:00
Jedr Blaszyk
6054ca36cf
[Connector API] Support filtering by name, index name in list action (#105131) 2024-02-05 15:47:22 +01:00
Jedr Blaszyk
8f8bd334ab
[Connector API] Implement update index_name action (#104648) 2024-02-02 13:48:02 +01:00
Jedr Blaszyk
75e11814fa
[Connectors API] Implement connector status update action (#104750) 2024-02-02 11:05:45 +01:00
Johannes Fredén
a9824042d8
Add rest spec for Query User API (#104529)
Add rest spec for Query User API
2024-02-02 08:21:01 +01:00
Panagiotis Bailis
7ce8d76559
Making k and num_candidates optional for knn search (#101209) 2024-02-01 15:43:09 +02:00
Salvatore Campagna
bdd3a4ffbe
Hash the tsid to overcome dimensions limits (#98023)
A Lucene limitation on doc values for UTF-8 fields does not allow  us to
write keyword fields whose size is larger then 32K. This limits  our
ability to map more than a certain number of dimension fields  for time
series indices. Before introducing this change the tsid is created as a
catenation of dimension field names and values into a keyword field.

To overcome this limitation we hash the tsid. This PR is intended to be
used as a draft to test different options.

Note that, as a side effect, this reduces the size of the tsid field as
a result of storing far less data when the tsid is hashed. Anyway, we
expect tsid hashing to affect compression of doc values and resulting in
larger storage footprint. Effect on query latency needs to be evaluated
too.

Resolves #93564
2024-02-01 08:25:31 -05:00
Navarone Feekery
d8ff2892ce
[Connectors API] Add new field api_key_secret_id to Connector (#104982)
- Add api_key_secret_id field
- Add update endpoint for api_key_id and api_key_secret_id
2024-02-01 13:50:58 +01:00
Michael Peterson
06a25b60c9
Add keep_alive param to the async-search status endpoint (#104629) 2024-01-31 17:25:37 -05:00
Chenhui Wang
fa97f08df1
[Connector API] Add job type filtering support for List connector sync jobs API (#104855) 2024-01-31 23:19:45 +08:00
Navarone Feekery
50afaad369
[Connector Secrets] Add delete API endpoint (#104815)
* Add DELETE endpoint for /_connector/_secret/{id}
* Add endpoint to write_connector_secrets cluster privilege
2024-01-30 13:39:15 +01:00
Matt Culbreth
de68d915de
Fix _alias/<alias> returning non-matching data streams (#104145)
This fixes a bug where GET _alias/<alias> would return non-matching data streams
2024-01-29 16:22:02 -05:00
Benjamin Trent
7df0567cbb
Require the name field for inner_hits for collapse (#104666)
`name` is de facto required for `collapse.inner_hits`. It always has been, but we have never validated up front. Instead we accidentally try to serialize `null`, which leads to exciting and confusing errors.

closes: https://github.com/elastic/elasticsearch/issues/104647
2024-01-29 08:45:09 -05:00
Lorenzo Dematté
0e328dbfc8
DesiredNode: deprecate node_version field and make it optional (unused) in current parser (#104209)
Deprecated node_version field, made it optional(unused) in new parser
Added deprecation warning handler for mixed cluster
Split tests for old vs. current format
2024-01-29 14:09:45 +01:00
Navarone Feekery
bed59ba84f
[Enterprise Search] Add .connector-secrets system index (#104766)
- Introduce new internal system index called .connector-secrets
- Add GET and POST requests for connector secrets
- Add permission sets for read and write connector secrets
2024-01-26 11:20:32 +01:00
Navarone Feekery
05ea8c7a0f
Revert "[Enterprise Search] Add .connector-secrets system index and GET/POST requests (#103683)" (#104760)
This reverts commit b4345d9d91.
2024-01-25 14:33:33 +01:00
Navarone Feekery
b4345d9d91
[Enterprise Search] Add .connector-secrets system index and GET/POST requests (#103683)
- Introduce new internal system index called .connector-secrets
- Add GET and POST requests for connector secrets
- Create read_connector_secrets and write_connector_secrets role permissions
2024-01-25 13:56:07 +01:00
Jedr Blaszyk
d5c0dcf675
[Connectors API] Implement update service type action (#104643) 2024-01-24 15:14:43 +01:00
Jedr Blaszyk
0344b40234
[Connectors API] Implement update native action endpoint (#104654) 2024-01-24 12:47:17 +01:00
Jan Kuipers
5dec83f69e
Endpoint to test Grok pattern (#104394)
* Add extract match ranges functionality to Grok.

* TestGrokPatternAction and Request

* TestGrokPattern response

* Update docs/changelog/104394.yaml

* Polish validation error message

* Improve test_grok_pattern API

* Add explicit CharSet

* Add endpoint to operator constants

* Add TransportTestGrokPatternActionTests

* REST API spec

* One more TransportTestGrokPatternActionTest

* Fix API spec

* Refactor REST API spec

* Polish code

* Replace TransportTestGrokPatternActionTests by a YAML REST test

* Add ecs_compatibility

* Always return arrays in the API

* Documentation

* YAML test for ecs_compatibility

* Rename doc fileø

* serverless scope

* Fix docs (hopefully)

* Update docs/reference/rest-api/index.asciidoc

Co-authored-by: István Zoltán Szabó <istvan.szabo@elastic.co>

* Add "text structure APIs" header in docs TOC

* Move file

* Remove test grok from main index

* typo

* Nested APIs underneath text structure

---------

Co-authored-by: István Zoltán Szabó <istvan.szabo@elastic.co>
2024-01-24 09:35:59 +01:00
eyalkoren
6f4e293d29
Add require_data_stream feature (#101872)
Closes #97032

Adding the ability to set `require_data_stream` parameter (boolean) on bulk and indexing APIs.
For document indexing, this flag requires the indexing operation to either be pointed at a data stream, or match a template that will create a data stream.
2024-01-18 09:15:48 -07:00
Nik Everett
42bda44adf
Fix async yaml tests (#104488)
This fixes a problem with the async tests for `drop_null_columns`
caused by us not passing the option when fetching from the async index.
This option wasn't actually supported so I had to plumb that through as
well.
2024-01-17 16:31:01 -05:00
Benjamin Trent
e4feaff900
Add support for more than one inner_hit when searching nested vectors (#104006)
This commit adds the ability to gather more than one inner_hit when
searching nested kNN.

# Global kNN example

```
POST test/_search
{
    "_source": false,
    "fields": [
        "name"
    ],
    "knn": {
        "field": "nested.vector",
        "query_vector": [
            -0.5,
            90,
            -10,
            14.8,
            -156
        ],
        "k": 3,
        "num_candidates": 3,
        "inner_hits": {
            "size": 2,
            "fields": [
                "nested.paragraph_id"
            ],
            "_source": false
        }
    }
}
```

Results in

<details>

```
{
    "took": 66,
    "timed_out": false,
    "_shards": {
        "total": 2,
        "successful": 2,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 2,
            "relation": "eq"
        },
        "max_score": 0.009090909,
        "hits": [
            {
                "_index": "test",
                "_id": "2",
                "_score": 0.009090909,
                "fields": {
                    "name": [
                        "moose.jpg"
                    ]
                },
                "inner_hits": {
                    "nested": {
                        "hits": {
                            "total": {
                                "value": 2,
                                "relation": "eq"
                            },
                            "max_score": 0.009090909,
                            "hits": [
                                {
                                    "_index": "test",
                                    "_id": "2",
                                    "_nested": {
                                        "field": "nested",
                                        "offset": 0
                                    },
                                    "_score": 0.009090909,
                                    "fields": {
                                        "nested": [
                                            {
                                                "paragraph_id": [
                                                    "0"
                                                ]
                                            }
                                        ]
                                    }
                                },
                                {
                                    "_index": "test",
                                    "_id": "2",
                                    "_nested": {
                                        "field": "nested",
                                        "offset": 1
                                    },
                                    "_score": 0.004968944,
                                    "fields": {
                                        "nested": [
                                            {
                                                "paragraph_id": [
                                                    "2"
                                                ]
                                            }
                                        ]
                                    }
                                }
                            ]
                        }
                    }
                }
            },
            {
                "_index": "test",
                "_id": "3",
                "_score": 0.0021519717,
                "fields": {
                    "name": [
                        "rabbit.jpg"
                    ]
                },
                "inner_hits": {
                    "nested": {
                        "hits": {
                            "total": {
                                "value": 1,
                                "relation": "eq"
                            },
                            "max_score": 0.0021519717,
                            "hits": [
                                {
                                    "_index": "test",
                                    "_id": "3",
                                    "_nested": {
                                        "field": "nested",
                                        "offset": 0
                                    },
                                    "_score": 0.0021519717,
                                    "fields": {
                                        "nested": [
                                            {
                                                "paragraph_id": [
                                                    "0"
                                                ]
                                            }
                                        ]
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        ]
    }
}
```

</details>

# kNN Query example

With a kNN query, this opens an interesting door, which allows for
multiple inner_hit scoring schemes.

## Nearest by max passage only

```
POST test/_search
{
    "size": 3,
    "query": {
        "nested": {
            "path": "nested",
            "score_mode": "max",
            "query": {
                "knn": {
                    "field": "nested.vector",
                    "query_vector": [
                        -0.5,
                        90,
                        -10,
                        14.8,
                        -156
                    ],
                    "num_candidates": 5
                }
            },
            "inner_hits": {
                "size": 2,
                "_source": false,
                "fields": [
                    "nested.paragraph_id"
                ]
            }
        }
    }
}
```

</details>

closes: https://github.com/elastic/elasticsearch/issues/102950
2024-01-17 11:32:46 -05:00
Nik Everett
919d282aa6
ESQL: Add option to drop null fields (#102428)
This adds an option to drop columns that are entirely null from the
results. Is this something we want?
2024-01-17 09:06:19 -05:00
Benjamin Trent
0c98fb2a8e
Simplify the int8_hnsw MIP yaml test (#104331)
The test is unnecessarily complicated with its vectors. This simplifies
the vectors and the test. We mainly care about extreme weirdness &
server level failures.

closes: https://github.com/elastic/elasticsearch/issues/104297
2024-01-16 08:07:11 -05:00
Luca Cavanna
4717f9c5c1
Don't throw error for remote shards that open PIT filtered out (#104288)
We recently introduced support for index_filter to the open point in time API (see #102388).
Open point in time supports executing against remote indices, in which case it will open a
reader context against the target remote shards. With support for index_filter, shards that
cannot match the filter are not even included in the PIT id that open PIT returns.

When the following search is executed that includes such PIT id, there is one search shards call
per cluster performed, which will return all shards from the targeted indices, including those
that open PIT has filtered out. In that case, we should just ignore those shards instead of
throwing exception when those are looked up in the search context id map built from the PIT id.

Closes #102596
2024-01-15 15:36:33 +01:00
Nik Everett
c2426ce886
ESQL: Run yaml tests async (#104205)
This adds tests that run the our suite of yaml tests against the ESQL
async endpoint. That's quite nice because the yaml tests are where we
handle lots of fun error cases and this'll make sure async does sensible
things in those cases.
2024-01-10 15:58:12 -05:00
Benjamin Trent
04b472263c
Fix profiling when kNN is nested with inner_hits (#103997)
The assertion here:

38867b7fb6/server/src/main/java/org/elasticsearch/search/fetch/FetchSearchResult.java (L64)

Assumes that profiling should never be overridden. However, when using
kNN & inner_hits we execute separate fetch phases for those inner_hits.
To prevent this assertion, I propose we have the inner hits context
return `null` for the profiler. The top level profiler is all we care
about with `fetch` and that is what we return to the user.

NOTE: Since this is an assertion, and the top-level fetch is unaffected,
production environments aren't effected by the original bug nor by this
fix.

closes: https://github.com/elastic/elasticsearch/issues/103985
2024-01-09 15:29:52 -05:00
Mary Gouseti
046cdeae23
Introduce lazy rollover for mapping updates in data streams (#103309)
In this PR we implement the idea to introduce a flag, that a data stream needs to be rolloved over before the next document is indexed.
2024-01-08 15:07:16 +02:00
Keith Massey
fdc1dcddf3
Allowing warnings caused by the presence of a global template in simulate ingest yaml rest tests (#103987) 2024-01-05 09:41:03 -06:00
Daniel Mitterdorfer
ff68a255f2
[Profiling] Add REST test case (#103675)
With this commit we add REST test cases for Universal Profiling.
2024-01-03 13:01:45 +01:00
Nikolaj Volgushev
512aff5829
Add active_only flag to Get API Key REST spec (#103621)
https://github.com/elastic/elasticsearch/pull/98259 added a new flag for
the Get API key API. I missed adding it to the REST API spec originally.


This PR corrects the REST spec.
2023-12-21 05:52:15 -05:00
Jedr Blaszyk
4e898d2e60
[Connectors API][Docs] Changed stubbed doc links for actions (#103563) 2023-12-19 16:05:57 +01:00
Kathleen DeRusso
a2dc45bc02
[Synonyms] Mark Synonyms as GA (#103223)
* Remove beta from synonyms docs and json definitions

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2023-12-14 14:53:43 -05:00