New dashboard to kibana index using java API


I want to add dashboard through java API. I'm able to add that, but need a clarification. I have constructed one source for indexing as below

I have created a java POJO and converted that to json object, which will be input to source

My java POJO has following fields

/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;

String title;

/** hits. */
int hits;

/** The description. */
String description;

@JsonSerialize(using = MySerializer.class)
PanelJSON[] panelsJSON;

@JsonSerialize(using = MySerializer.class)
OptionsJSON optionsJSON;

@JsonSerialize(using = MySerializer.class)
String uiStateJSON;

Boolean timeRestore;

String timeTo;

String timeFrom;

Interval refreshInterval;

KibanaSavedObjectMeta kibanaSavedObjectMeta;

Does it mandatory to give values to all fields?? I have skipped giving value to uiStateJSON. Is it fine? what is it meant for ? Also what is use of OptionsJSON?

Is there a sample POJO example and relevant serializer class, which I can reuse?

I don't know Java, so I can't help you there, but whatever you see in the saved objects that Kibana creates probably needs to be there for things to work correctly. And note that it's not stable, that object can change at any time, Kibana can upgrade it, but if you later index a document with the wrong schema, you can cause Kibana to stop working.

The easiest way to see what the POJO structure needs to look like it simply to create whatever you want to write (visualizations, saved search, dashboard...), then export it from Management > Saved Objects.

Thanks for the reply. Can you please forward this to releavant java team? My question is more specific to Java POJO. Also I want to know use of optionsJSON and UIStateJSON? What will happen if both fields are empty?

This is how much I don't know Java, I didn't even realize it was a Java question ;).

I don't have admin access here, so I can't move it myself. @warkolm maybe you can?

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