# Java API

**URL:** <https://discuss.elastic.co/t/java-api/5218>\
**Category:** Elasticsearch\
**Created:** [August 22, 2011, 10:02am UTC](https://discuss.elastic.co/t/java-api/5218 "2011-08-22T10:02:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gennady\_Novik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gennady_novik/32/3135_2.png) [@Gennady\_Novik](https://discuss.elastic.co/u/Gennady_Novik)\
**Post date:** [August 22, 2011, 10:02am UTC](https://discuss.elastic.co/t/java-api/5218/1 "2011-08-22T10:02:02Z")

</div>

How using Java API it is possible to construct next query: (f\_name="a\*" or  
f\_name="b\*") and (l\_name="c\*")

- 
  - wildcard

Thanks

---

<div class="post-metadata">

**Author:** ![Nicolas\_Lalevee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nicolas_lalevee/32/2892_2.png) [@Nicolas\_Lalevee](https://discuss.elastic.co/u/Nicolas_Lalevee)\
**Post date:** [August 22, 2011, 12:59pm UTC](https://discuss.elastic.co/t/java-api/5218/2 "2011-08-22T12:59:58Z")

</div>

Le 22 août 2011 à 12:02, Gennady Novik a écrit :

> How using Java API it is possible to construct next query: (f\_name="a\*" or f\_name="b\*") and (l\_name="c\*")
> 
> - 
> - wildcard

it is possible, look at the prefix query:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Nicolas

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [August 22, 2011, 6:54pm UTC](https://discuss.elastic.co/t/java-api/5218/3 "2011-08-22T18:54:53Z")

</div>

To add to the mentioned answer below, all queries / filters are provided  
through simple static factories either using the QueryBuilders or  
FilterBuilders classes. Check how to use it here:  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/query-dsl.html). The  
search page has an example of how to use it when searching:  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/java-api/search.html).

2011/8/22 Nicolas Lalevée [nicolas.lalevee@hibnet.org](mailto:nicolas.lalevee@hibnet.org)

> Le 22 août 2011 à 12:02, Gennady Novik a écrit :
> 
> > How using Java API it is possible to construct next query: (f\_name="a\*"  
> > or f\_name="b\*") and (l\_name="c\*")
> > 
> > - 
> > - wildcard
> 
> it is possible, look at the prefix query:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html)
> 
> Nicolas

---

<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:** [July 6, 2017, 3:56am UTC](https://discuss.elastic.co/t/java-api/5218/4 "2017-07-06T03:56:20Z")

</div>


