# What's the meaning of the underscore in the java api's methods, e.g., \_toQuery()

**URL:** <https://discuss.elastic.co/t/whats-the-meaning-of-the-underscore-in-the-java-apis-methods-e-g-toquery/358149>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [April 24, 2024, 4:36pm UTC](https://discuss.elastic.co/t/whats-the-meaning-of-the-underscore-in-the-java-apis-methods-e-g-toquery/358149 "2024-04-24T16:36:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![buitcj](https://avatars.discourse-cdn.com/v4/letter/b/a587f6/32.png) [@buitcj](https://discuss.elastic.co/u/buitcj)\
**Post date:** [April 24, 2024, 4:36pm UTC](https://discuss.elastic.co/t/whats-the-meaning-of-the-underscore-in-the-java-apis-methods-e-g-toquery/358149/1 "2024-04-24T16:36:57Z")

</div>

\_toQuery() is a public method that's used in examples on public docs (like [Searching for documents | Elasticsearch Java API Client [8.13] | Elastic](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/searching.html)), so the method isn't internal - something the underscore sometimes represents.

So what is the significance of methods that start with underscore in the java api?

Just curious and kinda wondering if I should be avoiding them.

---

<div class="post-metadata">

**Author:** ![ltrotta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ltrotta/32/124003_2.png) [@ltrotta](https://discuss.elastic.co/u/ltrotta)\
**Post date:** [May 6, 2024, 1:32pm UTC](https://discuss.elastic.co/t/whats-the-meaning-of-the-underscore-in-the-java-apis-methods-e-g-toquery/358149/2 "2024-05-06T13:32:06Z")

</div>

Hello!  
The underscore methods in the java clients represent methods that don't come from the Elasticsearch APIs. They're not internal, they are utilities that the client provides, and the underscore is there to help distinguish them from Elasticsearch APIs methods with a similar name. You should definitely use them if needed 🙂

---

<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:** [June 3, 2024, 1:32pm UTC](https://discuss.elastic.co/t/whats-the-meaning-of-the-underscore-in-the-java-apis-methods-e-g-toquery/358149/3 "2024-06-03T13:32:57Z")

</div>

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