API search/universal: Missing search type result

Hi,
i’m using Graylog 4.3.10. In Swagger API module I’m using the /search/universal/relative

but when I set the sort param (@timestamp:desc) I have an error message
image

If I remove the sort operation the rest return 200 and it works fine.

Is it a graylog bug?
Gianluca

Hey,

Not sure, I just tried it without an issue.

Thanks
the problems could be present when graylog is empty (currently it is empty)?
this is the stack trace

2023-02-08 14:17:13,573 ERROR: org.graylog2.shared.rest.exceptionmappers.AnyExceptionClassMapper - Unhandled exception in REST resource
java.lang.IllegalStateException: Missing search type result!
at org.graylog2.rest.resources.search.SearchResource.lambda$extractSearchResponse$3(SearchResource.java:245) ~[graylog.jar:?]
at java.util.Optional.orElseThrow(Unknown Source) ~[?:?]
at org.graylog2.rest.resources.search.SearchResource.extractSearchResponse(SearchResource.java:245) ~[graylog.jar:?]
at org.graylog2.rest.resources.search.SearchResource.search(SearchResource.java:100) ~[graylog.jar:?]
at org.graylog2.rest.resources.search.RelativeSearchResource.searchRelative(RelativeSearchResource.java:106) ~[graylog.jar:?]
at jdk.internal.reflect.GeneratedMethodAccessor245.invoke(Unknown Source) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52) ~[graylog.jar:?]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124) ~[graylog.jar:?]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167) ~[graylog.jar:?]
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:219) ~[graylog.jar:?]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79) ~[graylog.jar:?]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:469) ~[graylog.jar:?]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:391) ~[graylog.jar:?]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:80) ~[graylog.jar:?]
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:255) [graylog.jar:?]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248) [graylog.jar:?]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244) [graylog.jar:?]
at org.glassfish.jersey.internal.Errors.process(Errors.java:292) [graylog.jar:?]
at org.glassfish.jersey.internal.Errors.process(Errors.java:274) [graylog.jar:?]
at org.glassfish.jersey.internal.Errors.process(Errors.java:244) [graylog.jar:?]
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265) [graylog.jar:?]
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234) [graylog.jar:?]
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:680) [graylog.jar:?]
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:356) [graylog.jar:?]
at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:200) [graylog.jar:?]
at com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:180) [graylog.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
at java.lang.Thread.run(Unknown Source) [?:?]

hey

first thing I noticed was this, how are you executing this api?

Hi @gsmith
i’m using graylog console.
If I set the sort criteria I have that error.
Without it the response give me 200 and no error is present on the graylog log

hello,

Are you using the @ sign with timestamp?
I tried again , using the api-browser, Im unable to reproduce this error. This time im using
@timestamp:desc from your post above.

Does this look like what your doing?

GL 4.3.11 /w Opensearch 1.3 & MongoDb 4.4

Do you see anything in Graylog/Elasticsearch/Mongo logs when you execute the api?

Hi @gsmith
the graylog log is what I post before, where you saw

java.lang.IllegalStateException: Missing search type result!

yes I tested it with @ sign with timestamp
The strange behavior is that the API works fine without sort

Could be a problem if there are no data currently ingested? I mean the sort give error if that field does not exist?

Ok it seems to be related to an empty environment.
Using the same graylog installation version, with incoming logs, the API does not give me error.
So it seems to be related to a bug

Gianluca

Ok I opened ad issue

because it seems a problema related to and empty environment

1 Like

Interesting bug.
How does this impact you, given that you have no data to search on? Just trying to understand how to prioritize.

1 Like

Hi @patrickmann
in my comany we use Graylog as data collector and our application has an UX where we show some graylog metrix and messages using ReST API.
In order to show that information I have that error when Graylog is empty. I know that the sort operation is optional, but I need to show the messages ordered by timestamp (as graylog do).
Currently I don’t know how fix it and if there is a workaround.

So currently I can just remove the sort operation but I it cannot be the final solution.
I hope you can fix it soon
Thanks
Gianluca

1 Like

Hey,

I just filled in Query, Range and Sort during my testing. I see your using the Stream ID also.
So I tested this again in the lab. This is the results of that test, Unfortantly I can not reproduce issue. Am I missing something?

EDIT: I used the most common Fields " source & Timestamp". If your using another unique field/s I would do a quick global search to ensure its there.

Ho @gsmith
I just use * as query but i don’t think that it can be a problem.
I see in you screenshot that there is a result, while in my case graylog elastic is empty.
I use timestamp field too.

Hi,
any news about it?

Hey @gianluca-valentini

Sorry, I cant reproduce this issue. Perhaps someone lese canjump in.

If you try this same search in the UI what happens? If it works, inspect the page, turn on network logging, and then run it again and you will see the api call. Then compare that to the api call from the api browser and see if anything is different.

@Joel_Duffield sorry but I don’t understand what you suggest me.

I use the Graylog user interface to get the intormation with the ReST servicesearch/universal.
The service works if I don’t set the order criteria and it works fine without it.

In each situation I have an empty installation (so on index and no data into graylog and elasticsearch)

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