Problem with search email field

I think you should use a fieldQuery instead of termQuery.

On Thursday, March 15, 2012 10:46:37 PM UTC+2, steam wrote:

Hello, i'll appreciate a lot if someone can help me.
I have one problem with search field (email) by term. I was building by
java
api index like

      XContentBuilder jsonBuilder = jsonBuilder()
              .startObject()
              .field(ItemConstant.FIELD_PROV_ID, item.getProvinceId())
              .field(ItemConstant.FIELD_PROV_DESC, 

item.getProvinceDesc())
.field(ItemConstant.FIELD_TITLE, item.getTitle())
.field(ItemConstant.FIELD_IMG_DIR, item.getImgDir())
.field(ItemConstant.FIELD_MAIL, item.getMail())
.endObject();

and then i trying to find by mail on elastic items

                    queryBuilder = 

boolQuery().must(termQuery(ItemConstant.FIELD_MAIL,
search.getMail()));
searchRequestBuilder.setQuery(queryBuilder);

            searchRequestBuilder.setFrom(search.getStartRowIndex())
            .setSize(search.getNumRows()).setExplain(true);
            
            //EXECUTE SEARCH
            response = searchRequestBuilder.execute().actionGet();

but nothing have found on response.
I think it must to be related with analizer, but i don't know where it
apply
to save field as is.
And if i search only with a word until @ it find the item.

Can someone help me please. Thanks.

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Problem-with-search-email-field-tp3829982p3829982.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.