Question about create data view API

i want to create a dataview with only "message" field,how can i make the post request?
the example only show "fields" is an object,but didnt tell the detail properties in the object.

$ curl -X POST api/data_views/data_view
{
"data_view": {
"id": "...",
"version": "...",
"title": "...",
"type": "...",
"timeFieldName": "...",
"sourceFilters": ,
"fields": {},
"typeMeta": {},
"fieldFormats": {},
"fieldAttrs": {},
"runtimeFieldMap": {}
"allowNoIndex": "..."
}
}

Hello! Hm, that documentation does seem to be incomplete.

I've opened an issue for tracking: [Data views] Documentation for create data view endpoint incomplete · Issue #135522 · elastic/kibana · GitHub

It looks like the expected shape of the sourceFilters field is:

...
  // Used by discover to hide fields.
  sourceFilters: [{value: "value"}]
...

I'm not certain this is going to do what you expect it should. Usually data views capture the full set of fields. You might be able to do this with field level security:

sourceFilters is only used by discover. I believe field level security is the only option.

thx for answer!i'm sorry i put the wrong checkbox on key "sourcefilter" by mistake and this make some misleading.My question is how to drop unnecessary fields when i create a dataview.Finally i achieved by edit filebeat.yml config.And the object "field" inner details will returned after i called kibana api "create dataview".

thx for answer!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.