Skip to content
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

[API] Add metafields from uiSettings to index patterns created by ingest API #7301

Merged
merged 2 commits into from
Jun 3, 2016

Conversation

Bargs
Copy link
Contributor

@Bargs Bargs commented May 26, 2016

Index patterns created via the ingest API weren't getting meta fields (_source, _id, etc.) saved in the index pattern's fields cache. This led to "unknown" fields showing up in Discover.

Now that #6849 is merged, I've re-worked this code to use the uiSettings module to grab the user configured (or default) metaFields and add them to any index pattern created via the ingest API.

How to test

POST to /api/kibana/ingest with a request payload like the following:

{
    "index_pattern": {
          "id": "logstash-*",
          "title": "logstash-*",
          "time_field_name": "@timestamp",
          "fields": [{
            "name": "ip",
            "type": "ip"
          }, {
            "name": "@timestamp",
            "type": "date"
          }, {
            "name": "agent",
            "type": "string"
          }, {
            "name": "bytes",
            "type": "number"
          }]
    }
}

In addition to the fields listed in the payload, the index pattern should also include any meta fields currently configured in the ui settings.

@Bargs
Copy link
Contributor Author

Bargs commented May 27, 2016

jenkins, test it


const metaFields = _.get(config, 'metaFields.userValue', config.metaFields.value);
Copy link
Contributor

@bevacqua bevacqua Jun 1, 2016

Choose a reason for hiding this comment

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

Consumers of the uiSettings shouldn't need to know internals like this. I suggest we add a .get(key) method like:

key => getAll().then(config => _.get(config, `${key}.userValue`, config[key].value));

Code here becomes:

const metaFields = await server.uiSettings().get('metaFields');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, I had to do a lot of trial and error to figure this out.

@bevacqua
Copy link
Contributor

bevacqua commented Jun 1, 2016

@Bargs PR looks great other than minor comments 🎉

@bevacqua bevacqua assigned Bargs and unassigned bevacqua Jun 1, 2016
@Bargs Bargs force-pushed the fix/metaFieldIngest branch from a1b69d4 to 46654c7 Compare June 1, 2016 22:18
@Bargs
Copy link
Contributor Author

Bargs commented Jun 1, 2016

@bevacqua I updated the code to use an implicit return and pushed the change. Do you mind if we merge this prior to adding the simplified getter to uiSettings and then updated it once it's in? I'd like to get this one last PR merged into feature/ingest before putting up the feature/ingest PR for merging to master.

@bevacqua
Copy link
Contributor

bevacqua commented Jun 3, 2016

LGTM

@bevacqua bevacqua removed their assignment Jun 3, 2016
@Bargs Bargs merged commit 8c56411 into elastic:feature/ingest Jun 3, 2016
cee-chen added a commit that referenced this pull request Nov 3, 2023
`v89.1.0`⏩`v90.0.0`

The majority of changes in this PR come from:

- **EuiContextMenu** being converted to Emotion
(elastic/eui#7312). If your usage of
`EuiContextMenu` was significantly affected, we recommend pulling down
this PR and QAing it locally.

- `defaultProps` being removed from some very widespread components,
particularly **EuiButton**, in anticipation of React's upcoming
deprecation.
(elastic/eui@b7dc9b4)
**NOTE**: This only affected Enzyme snapshots, and did not affect
production behavior.

[Commits](https://github.com/elastic/kibana/pull/170179/commits) have
been broken up by component changes as well as types of changes.

---

## [`90.0.0`](https://github.com/elastic/eui/tree/v90.0.0)

- Updated the `eventColor` prop on `EuiCommentEvent` to apply the color
to the entire comment header.
([#7288](elastic/eui#7288))
- Updated `EuiBasicTable` and `EuiInMemoryTable` to support a new
controlled selection API: `selection.selected`
([#7321](elastic/eui#7321))

**Bug fixes**

- Fixed controlled `EuiFieldNumbers` not correctly updating native
validity state ([#7291](elastic/eui#7291))
- Fixed `EuiListGroupItem` to pass `style` props to the wrapping `<li>`
element alongside `className` and `css`. All other props will be passed
to the underlying content.
([#7298](elastic/eui#7298))
- Fixed `EuiListGroupItem`'s non-transitioned transform on hover/focus
([#7298](elastic/eui#7298))
- Fixed `EuiDataGrid`s with `gridStyle.stripes` sometimes showing buggy
row striping after being sorted
([#7301](elastic/eui#7301))
- Fixed `EuiDataGrid`'s `gridStyle.rowClasses` API to not conflict with
`gridStyle.stripes` if dynamically updated
([#7301](elastic/eui#7301))
- Fixed `EuiDataGrid`'s `gridStyle.rowClasses` API to support multiple
space-separated classes
([#7301](elastic/eui#7301))
- Fixed `EuiInputPopover` not calling `onPanelResize` callback prop
([#7305](elastic/eui#7305))
- Fixed `EuiDualRange` incorrectly positioning highlights when rendered
with `showInput="inputWithPopover"`
([#7305](elastic/eui#7305))
- Fixed `EuiTabs` incorrectly wrapping text when it should instead
either scroll or truncate
([#7309](elastic/eui#7309))
- `EuiContextMenu` now renders text colors correctly when used within an
`EuiBottomBar` ([#7312](elastic/eui#7312))
- Fixed the width of `EuiSuperDatePicker`'s Absolute date picker
([#7313](elastic/eui#7313))
- Fixed `EuiDataGrid` cells visually cutting off overflowing content a
little too quickly ([#7320](elastic/eui#7320))

**Deprecations**

- Deprecated `EuiBasicTable` and `EuiInMemoryTable`'s ref `setSelection`
API. Use the new `selection.selected` API instead.
([#7321](elastic/eui#7321))

**Breaking changes**

- Removed `EuiPageTemplate_Deprecated`, `EuiPageSideBar_Deprecated`, and
`EuiPageContent*_Deprecated`
([#7265](elastic/eui#7265))
- Removed the `ghost` color option from `EuiButton`, `EuiButtonEmpty`,
and `EuiButtonIcon`. Use an `<EuiThemeProvider colorMode="dark">`
wrapper and `color="text"` instead.
([#7296](elastic/eui#7296))

**Dependency updates**

- Updated `refractor` to v3.6.0
([#7127](elastic/eui#7127))
- Updated `rehype-raw` to v5.1.0
([#7127](elastic/eui#7127))
- Updated `vfile` to v4.2.1
([#7127](elastic/eui#7127))

**Accessibility**

- `EuiContextMenu` now correctly respects reduced motion preferences
([#7312](elastic/eui#7312))
- `EuiAccordion`s no longer attempt to focus child content when the
accordion is externally opened via `forceState`, but will continue to
focus expanded content when users click the toggle button.
([#7314](elastic/eui#7314))

**CSS-in-JS conversions**

- Converted `EuiContextMenu`, `EuiContextMenuPanel`, and
`EuiContextMenuItem` to Emotion; Removed `$euiContextMenuWidth`
([#7312](elastic/eui#7312))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants