-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[IndexPatterns] Support cross cluster search #11114
[IndexPatterns] Support cross cluster search #11114
Conversation
88a5df3
to
37e2460
Compare
b3cf2a2
to
5c4095d
Compare
8f7d173
to
e6f7fe2
Compare
4544994
to
6890ba2
Compare
db157a3
to
71d6159
Compare
this PR changes almost 5k SLoC I really wonder if we can break it up and make smaller PRs our of this. It's impossible to review something like this in a sane way? I mean I don't know much or rather nothing about javascript but this is pretty massive? |
Yeah it's quite large... I'm wondering, does the move from _field_stats to _field_caps necessitate a move from the front end to the back end? I'm just thinking, if we're going to remove date patterns and expanded index patterns in the somewhat near future, it might be easier to move mapping handling to the server side after that since there will be less legacy code to replicate? I'm not terribly familiar with the requirements for cross cluster search though, so there may be reasons I'm missing.
What does a "cross cluster" index pattern imply? Is it just that those modes get disabled, or is there more to it? Why a |
It doesn't anymore. We thought it would until elastic/elasticsearch#24463, when it was a serious possibility that Kibana was going to have to connect to all of the clusters and get field_caps from them independently.
That's probably possible, but @epixa and I decided to do it now because we needed to be ready for the situation in my first answer. The server-side part of this PR is about 500 lines of code, 15% of the PR, so I really don't think it saves us that much to reimplement this as client-side only and move it to the server later.
When an index pattern is cross cluster Kibana can't talk directly to the clusters that have the data, it can only use the |
@@ -186,11 +186,8 @@ export function SegmentedRequestProvider(es, Private, Promise, timefilter, confi | |||
|
|||
return indexPattern.toDetailedIndexList(timeBounds.min, timeBounds.max, this._direction) | |||
.then(queue => { | |||
if (!_.isArray(queue)) queue = [queue]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When was this condition hit before this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toDetailedIndexList()
previously returned an array when there were multiple indexes, and a single object if not, but now it just always returns an array with 1 or more objects in it.
import { resolve as resolveUrl, format as formatUrl } from 'url'; | ||
|
||
import { pick, mapValues } from 'lodash'; | ||
import 'whatwg-fetch'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't, removing. I was originally planning to use it, but using the $http
service helps this client integrate better with existing code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we use this module anywhere else? Can we just remove it from package.json entirely?
The This allows us to see which of the existing indices will match when we use the time pattern to create index names based on the time filter, and most importantly allows us to pull field capabilities for indices we know exist, rather than just generating 10 or so index names and hoping one or more of them exists. |
When I specify a CCS enabled index pattern during creation, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, and except for what Court mentions, everything works as expected for me.
…ld-capabilities-api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending the fix of that last comment of mine
💃 💃 💃 💃 💃 💃 💃 💃 💃 |
* [indexPatterns] support cross cluster patterns * [vis] remove unused `hasTimeField` param * [indexPatterns/create] fix method name in view * [indexPatterns/create] disallow expanding with ccs * [indexPatterns/create] field fetching is cheaper, react faster * [indexPatterns/resolveTimePattern/tests] increase readability * [tests/apiIntegration/indexPatterns] test conflict field output * [indexPatterns/fieldCaps/readFieldCapsResponse] add unit tests * [test/apiIntegration] ensure random word will not be valid * [indexPatterns/ui/client] remove unused import * remove use of auto-release-sinon * [indexPatterns/create] don't allow expand when cross cluster * [indexPatternsApiClient/stub] use angular promises * [indexPatterns/create] add tests for base create ui behaviors (cherry picked from commit e5deca6)
🎉 |
* [indexPatterns] support cross cluster patterns * [vis] remove unused `hasTimeField` param * [indexPatterns/create] fix method name in view * [indexPatterns/create] disallow expanding with ccs * [indexPatterns/create] field fetching is cheaper, react faster * [indexPatterns/resolveTimePattern/tests] increase readability * [tests/apiIntegration/indexPatterns] test conflict field output * [indexPatterns/fieldCaps/readFieldCapsResponse] add unit tests * [test/apiIntegration] ensure random word will not be valid * [indexPatterns/ui/client] remove unused import * remove use of auto-release-sinon * [indexPatterns/create] don't allow expand when cross cluster * [indexPatternsApiClient/stub] use angular promises * [indexPatterns/create] add tests for base create ui behaviors (cherry picked from commit e5deca6)
Closes #11014
Closes #11011
Fixes #9028
Fixes #8373
Fixes #9386
FIxes #9028
... there are probably others
Summary:
Index Patterns can now point to indices from remote clusters when using Elasticsearch's cross cluster search feature. After setting it up in elasticsearch, just mention the remote cluster alias in the index name like so:
remoteCluster:indexName
.When using cross cluster search, we have to pull the field definitions for index patterns in a cross-cluster friendly way, meaning we have to move over to the new cross cluster compatible
_field_caps
api in elasticsearch instead of pulling_field_stats
and merging them with mappings.Technical Summary:
GET /api/index_patterns/_fields_for_wildcard?pattern=logstash-*
logstash-*
wildcard patternreadFromDocValues
&meta_fields=["_index","_type"]
GET /api/index_patterns/_fields_for_time_pattern?pattern=[logstash-]YYYY&look_back=10
[logstash-]YYYY
is converted into a wildcard and then matched against the output of the_aliases
apilook_back
determines how many) are then used with the_field_caps
api_aliases
endpoint means that time patterns are not cross cluster search compatible:
in your index pattern converts it into a "cross cluster" index pattern and disables theexpand wildcard
andtime pattern
index pattern "modes"