How can i query elastic

I want to fetch data from a elastic index which is linked with a stream

can you give some code sample’s ??

can i use UniversalSearchStore to do any kind of search if so how ??


What did you want todo?

  • use the API of Elasticsearch?
  • use the API of Graylog?
  • use the Graylog Webinterface?


@jan im working on an plugin where i need to fetch data from graylog stream how can i do that ??

should i do new connection to elastic and do it ?
or is there any build in graylog server function which i can call ??

please help

Take a look at the Searches and Indices classes.

is there any way i can query for index “xxxx” which is not mapped with any stream

after analysing this classes i feel query happens only through stream id like this

final TermsResult terms  = searches.terms("metricbeat_system_cpu_idle_pctfield", 0, "streams:59ce8d2568521b04a981bca3", null, range);

 final SearchResult searchResult ="*", range, 5, 0, Sorting.DEFAULT);

is there any way i can pass my index name so that this actually searches only on my index

any suggestion will be helpful


No, that’s not possible.

so how can i achieve this scenario ??

Either write the functionality yourself and create a pull request in the graylog2-server repository, or try to achieve your goal in a different way.

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