# Elasticsearch 1.0.1 - wild card text search

**URL:** <https://discuss.elastic.co/t/elasticsearch-1-0-1-wild-card-text-search/16468>\
**Category:** Elasticsearch\
**Created:** [March 19, 2014, 3:06pm UTC](https://discuss.elastic.co/t/elasticsearch-1-0-1-wild-card-text-search/16468 "2014-03-19T15:06:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_F](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@Daniel\_F](https://discuss.elastic.co/u/Daniel_F)\
**Post date:** [March 19, 2014, 3:06pm UTC](https://discuss.elastic.co/t/elasticsearch-1-0-1-wild-card-text-search/16468/1 "2014-03-19T15:06:03Z")

</div>

Hi all,

I am using Java Elasticsearch API in my application. In 0.90 version of  
Elasticsearch I used the following code to build a text query:

QueryBuilder qb = QueryBuilders.fieldQuery(fieldName, matchPattern);

In the new release 1.0.1 there is no fieldQuery() method in the API. I have  
replaced the method by matchQuery():

QueryBuilder qb = QueryBuilders.matchQuery(fieldName, matchPattern);

but it does not behave in the same way. Looks like matchQuery() does an  
exact match of a term and does not support wildcards. For example, a  
pattern "d?g" will not match a term "dog" while fieldQuery() did.  
Unfortunately I did not find any documentation on how to replace  
fieldQuery() correctly.

My question is: How to implement wildcards functionality for 1.0.1 version  
in Java API?

Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9aa4e97c-93d5-4222-9d47-2d64357fe1c4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9aa4e97c-93d5-4222-9d47-2d64357fe1c4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 19, 2014, 3:23pm UTC](https://discuss.elastic.co/t/elasticsearch-1-0-1-wild-card-text-search/16468/2 "2014-03-19T15:23:23Z")

</div>

You should use QueryString instead.  
See [https://github.com/elasticsearch/elasticsearch/issues/4033](https://github.com/elasticsearch/elasticsearch/issues/4033)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 19 mars 2014 à 16:06:06, Daniel F. ([feinsteindl@gmail.com](mailto:feinsteindl@gmail.com)) a écrit:

Hi all,

I am using Java Elasticsearch API in my application. In 0.90 version of Elasticsearch I used the following code to build a text query:

QueryBuilder qb = QueryBuilders.fieldQuery(fieldName, matchPattern);

In the new release 1.0.1 there is no fieldQuery() method in the API. I have replaced the method by matchQuery():

QueryBuilder qb = QueryBuilders.matchQuery(fieldName, matchPattern);

but it does not behave in the same way. Looks like matchQuery() does an exact match of a term and does not support wildcards. For example, a pattern "d?g" will not match a term "dog" while fieldQuery() did. Unfortunately I did not find any documentation on how to replace fieldQuery() correctly.

My question is: How to implement wildcards functionality for 1.0.1 version in Java API?

## Thanks

You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9aa4e97c-93d5-4222-9d47-2d64357fe1c4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9aa4e97c-93d5-4222-9d47-2d64357fe1c4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/etPan.5329b66b.4962813b.97ca%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.5329b66b.4962813b.97ca%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Daniel\_F](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@Daniel\_F](https://discuss.elastic.co/u/Daniel_F)\
**Post date:** [March 19, 2014, 3:52pm UTC](https://discuss.elastic.co/t/elasticsearch-1-0-1-wild-card-text-search/16468/3 "2014-03-19T15:52:45Z")

</div>

Thanks David,

It worked with the following code:

QueryBuilder qb = QueryBuilders.queryString(matchPattern).field(fieldName);

Daniel

On Wednesday, March 19, 2014 5:06:03 PM UTC+2, Daniel F. wrote:

> Hi all,
> 
> I am using Java Elasticsearch API in my application. In 0.90 version of  
> Elasticsearch I used the following code to build a text query:
> 
> QueryBuilder qb = QueryBuilders.fieldQuery(fieldName, matchPattern);
> 
> In the new release 1.0.1 there is no fieldQuery() method in the API. I  
> have replaced the method by matchQuery():
> 
> QueryBuilder qb = QueryBuilders.matchQuery(fieldName, matchPattern);
> 
> but it does not behave in the same way. Looks like matchQuery() does an  
> exact match of a term and does not support wildcards. For example, a  
> pattern "d?g" will not match a term "dog" while fieldQuery() did.  
> Unfortunately I did not find any documentation on how to replace  
> fieldQuery() correctly.
> 
> My question is: How to implement wildcards functionality for 1.0.1 version  
> in Java API?
> 
> Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/422f0ad0-2567-4551-8baf-625961ce5bf0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/422f0ad0-2567-4551-8baf-625961ce5bf0%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:42am UTC](https://discuss.elastic.co/t/elasticsearch-1-0-1-wild-card-text-search/16468/4 "2017-07-06T01:42:06Z")

</div>


