steam
(steam)
March 15, 2012, 8:46pm
1
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.
canavar
(canavar)
March 15, 2012, 9:17pm
2
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 .
steam
(steam)
March 16, 2012, 4:13pm
3
Many thanks !!! It is working with fieldQuery.
Thanks for suggestion !
2012/3/15 canavar [via Elasticsearch Users]
ml-node+s115913n3830072h26@n3.nabble.com :
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 .
If you reply to this email, your message will be added to the discussion
below:
http://elasticsearch-users.115913.n3.nabble.com/Problem-with-search-email-field-tp3829982p3830072.html
To unsubscribe from Problem with search email field., click here.
NAML