# Search API example

**URL:** <https://discuss.elastic.co/t/search-api-example/145500>\
**Category:** Elasticsearch\
**Created:** [August 22, 2018, 7:12am UTC](https://discuss.elastic.co/t/search-api-example/145500 "2018-08-22T07:12:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raghuveer\_SJ](https://avatars.discourse-cdn.com/v4/letter/r/2bfe46/32.png) [@Raghuveer\_SJ](https://discuss.elastic.co/u/Raghuveer_SJ)\
**Post date:** [August 22, 2018, 7:12am UTC](https://discuss.elastic.co/t/search-api-example/145500/1 "2018-08-22T07:12:51Z")

</div>

I am new to search so just started learning. I am trying to connect to an existing node and do a basic search.

```
	RestHighLevelClient client = new RestHighLevelClient(
			RestClient.builder(new HttpHost("localhost", 9200, "http")));

```

But the examples that I see is from Node instance. I am not doing unit testing, want to connect to an existing node.

So let say I want to search for error logs with messages having 500 error code like `logLevel: ERROR and logMessage: *500*` So what should the JAVA code for query look like please ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 19, 2018, 7:12am UTC](https://discuss.elastic.co/t/search-api-example/145500/2 "2018-09-19T07:12:52Z")

</div>

Closed on September 19, 2018, 7:12am UTC

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