How can i query elastic


(Manjunath) #1

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 ??

Thanks
Manju


(Jan Doberstein) #2

What did you want todo?

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

elaborate


(Manjunath) #3

@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


(Jochen) #4

Take a look at the Searches and Indices classes.



(Manjunath) #5

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 = searches.search("*", 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

Thanks
Manju


(Jochen) #6

No, that’s not possible.


(Manjunath) #7

so how can i achieve this scenario ??


(Jochen) #8

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.


(system) #9

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