Skip to content

[Index pattern] Add support for composite runtime fields#103879

Closed
sebelga wants to merge 20 commits intoelastic:masterfrom
sebelga:index-pattern-field-editor/object-runtime-fields
Closed

[Index pattern] Add support for composite runtime fields#103879
sebelga wants to merge 20 commits intoelastic:masterfrom
sebelga:index-pattern-field-editor/object-runtime-fields

Conversation

@sebelga
Copy link
Contributor

@sebelga sebelga commented Jun 30, 2021

Fixes #99177

This PR is the implementation of the #99462 discussion.

It is not yet possible to fully test this PR in Discover as ES does not support the object runtime field type. But once they do, I expect very few changes in this PR.

Currently if we navigate in Discover we don't see the subFields because they don't exist in the search response. And the parent object shows up in the list of fields because I temporarily hardcode it to the keyword type to avoid the search request to throw an error.

In the index pattern management we do see the subFields as they are added to the list from the runtimeFieldMap

Screenshot 2021-06-30 at 14 54 02

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a breaking change as EnhancedRuntimeField has added prop (no prop has been removed or renamed)

Copy link
Contributor Author

@sebelga sebelga Jun 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prevent deleting a subField directly as this will have to be done by editing the runtime composite script.

Copy link
Contributor Author

@sebelga sebelga Jun 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prevent editing a subField directly as this will have to be done by editing the runtime composite script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep consistency with ES we will always return an array, even if it is for one field created.

@sebelga sebelga force-pushed the index-pattern-field-editor/object-runtime-fields branch from a197112 to fd89bb9 Compare August 23, 2021 10:01
@sebelga sebelga changed the title [Index pattern] Add support for object runtime fields [Index pattern] Add support for composite runtime fields Aug 23, 2021
@sebelga sebelga force-pushed the index-pattern-field-editor/object-runtime-fields branch from b250f58 to feaa415 Compare August 24, 2021 16:23
@sebelga sebelga force-pushed the index-pattern-field-editor/object-runtime-fields branch from 0b3357d to 9244923 Compare August 26, 2021 11:17
@kibanamachine
Copy link
Contributor

kibanamachine commented Aug 26, 2021

💔 Build Failed

Failed CI Steps


Test Failures

Kibana Pipeline / jest / Jest Tests.src/plugins/data/common/index_patterns/index_patterns.IndexPattern toSpec should match snapshot

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches


Stack Trace

Error: expect(received).toMatchSnapshot()

Snapshot name: `IndexPattern toSpec should match snapshot 1`

- Snapshot  - 1
+ Received  + 1

@@ -771,19 +771,19 @@
        "type": "date",
      },
    },
    "id": "test-pattern",
    "intervalName": undefined,
+   "runtimeCompositeMap": Object {},
    "runtimeFieldMap": Object {
      "runtime_field": Object {
        "script": Object {
          "source": "emit('hello world')",
        },
        "type": "keyword",
      },
    },
-   "runtimeObjectMap": Object {},
    "sourceFilters": undefined,
    "timeFieldName": "time",
    "title": "title",
    "type": "index-pattern",
    "typeMeta": undefined,
    at Object.<anonymous> (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/src/plugins/data/common/index_patterns/index_patterns/index_pattern.test.ts:296:37)
    at Object.asyncJestTest (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Kibana Pipeline / jest / Jest Tests.src/plugins/data/common/index_patterns/index_patterns.IndexPatterns savedObjectToSpec

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches


Stack Trace

Error: expect(received).toMatchSnapshot()

Snapshot name: `IndexPatterns savedObjectToSpec 1`

- Snapshot  - 0
+ Received  + 1

@@ -10,10 +10,11 @@
      "field": Object {},
    },
    "fields": Object {},
    "id": "id",
    "intervalName": undefined,
+   "runtimeCompositeMap": Object {},
    "runtimeFieldMap": Object {
      "aRuntimeField": Object {
        "script": Object {
          "source": "emit('hello')",
        },
    at Object.<anonymous> (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/src/plugins/data/common/index_patterns/index_patterns/index_patterns.test.ts:248:18)
    at Object.asyncJestTest (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:75:41

Kibana Pipeline / jest / Jest Tests.src/plugins/discover/public/application/apps/main/components/sidebar.Discover IndexPattern Management renders correctly

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches


Stack Trace

Error: expect(received).toMatchSnapshot()

Snapshot name: `Discover IndexPattern Management renders correctly 1`

- Snapshot  - 0
+ Received  + 1

@@ -659,10 +659,11 @@
          "_type",
          "_source",
        ],
        "originalSavedObjectBody": Object {},
        "resetOriginalSavedObjectBody": [Function],
+       "runtimeCompositeMap": Object {},
        "runtimeFieldMap": Object {},
        "setFieldFormat": [Function],
        "shortDotsEnable": false,
        "sourceFilters": undefined,
        "timeFieldName": "time",
    at Object.<anonymous> (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/src/plugins/discover/public/application/apps/main/components/sidebar/discover_index_pattern_management.test.tsx:71:23)
    at Object.asyncJestTest (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)
    at /var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:45:12
    at new Promise (<anonymous>)
    at mapper (/var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
    at /var/lib/jenkins/workspace/elastic+kibana+pipeline-pull-request/kibana/node_modules/jest-jasmine2/build/queueRunner.js:75:41
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

and 3 more failures, only showing the first 3.

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
indexPatternFieldEditor 264.6KB 267.3KB +2.7KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
data 775.6KB 779.3KB +3.7KB
indexPatternFieldEditor 37.5KB 38.3KB +777.0B
total +4.5KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@sebelga
Copy link
Contributor Author

sebelga commented Aug 26, 2021

Closing in favour of #110226.

@sebelga sebelga closed this Aug 26, 2021
@sebelga sebelga deleted the index-pattern-field-editor/object-runtime-fields branch August 26, 2021 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Index pattern] Add support for object runtime field "subFields"

2 participants