Elasticsearch 1.0.1 - wild card text search

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9aa4e97c-93d5-4222-9d47-2d64357fe1c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

You should use QueryString instead.
See https://github.com/elasticsearch/elasticsearch/issues/4033

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 19 mars 2014 à 16:06:06, Daniel F. (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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9aa4e97c-93d5-4222-9d47-2d64357fe1c4%40googlegroups.com.
For more options, visit 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.
To view this discussion on the web visit 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.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/422f0ad0-2567-4551-8baf-625961ce5bf0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.