[Elasticsearch - Java api ] - How to write the select query for searching text mixed with special characters(John-one) across multiple fields using elasticsearch java api?

Hi everybody good afternoon, Please help me to come out of this problem. I
spent so much time to resolve this issue but I am not able to succeed.

        I have two users in my db collection and those names are 

'john' and 'john-son' , now I am trying to select all records which are
matching with my search text among all fields of db collection. For example
my search text is ' john' then my query is by using elasticsearch java api

QueryBuilder queryBuilderForUserSearch = QueryBuilders.fieldQuery("_all",
"" + q + "");

 It's working fine. But when I am trying to search with special 

character text like 'john-son' by this time it it returns zero records.
Can anybody please help me why it's happens and please provide the query
for select text with special characters also. I am really thankful to
them.

Thanks in advance.

--
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/d40fd5c8-ffa5-4fe5-ba99-dc6988fe6559%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

This is because "john-son" is most likely being broken down to two terms,
"john" and "son". What analyzer is being defined on your field?

Also note the "" + q + "" thing isn't necessary, this isn't SQL here

--

Itamar Syn-Hershko
http://code972.com | @synhershko https://twitter.com/synhershko
Freelance Developer & Consultant
Author of RavenDB in Action http://manning.com/synhershko/

On Fri, Jan 24, 2014 at 3:04 PM, purna2207@gmail.com wrote:

Hi everybody good afternoon, Please help me to come out of this problem. I
spent so much time to resolve this issue but I am not able to succeed.

        I have two users in my db collection and those names are

'john' and 'john-son' , now I am trying to select all records which are
matching with my search text among all fields of db collection. For example
my search text is ' john' then my query is by using elasticsearch java api

QueryBuilder queryBuilderForUserSearch = QueryBuilders.fieldQuery("_all",
"" + q + "");

 It's working fine. But when I am trying to search with special

character text like 'john-son' by this time it it returns zero records.
Can anybody please help me why it's happens and please provide the query
for select text with special characters also. I am really thankful to
them.

Thanks in advance.

--
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/d40fd5c8-ffa5-4fe5-ba99-dc6988fe6559%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/CAHTr4Zun_ojCDnKJc3SR%2BcoHTVwydayy%2BoqX9Syp6oHgEYrDAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Sir thanks for instant response, yes there is no necessity of "*" + q

  • "*" just " q " is enough. Present I am using standard-analyzer. Can you
    please help to come out of this problem.But it's(john-son) working
    properly on particular field search but not working "_all " field search.

On Friday, January 24, 2014 7:16:28 PM UTC+5:30, Itamar Syn-Hershko wrote:

This is because "john-son" is most likely being broken down to two terms,
"john" and "son". What analyzer is being defined on your field?

Also note the "" + q + "" thing isn't necessary, this isn't SQL here

--

Itamar Syn-Hershko
http://code972.com | @synhershko https://twitter.com/synhershko
Freelance Developer & Consultant
Author of RavenDB in Action http://manning.com/synhershko/

On Fri, Jan 24, 2014 at 3:04 PM, <purn...@gmail.com <javascript:>> wrote:

Hi everybody good afternoon, Please help me to come out of this problem.
I spent so much time to resolve this issue but I am not able to succeed.

        I have two users in my db collection and those names are 

'john' and 'john-son' , now I am trying to select all records which are
matching with my search text among all fields of db collection. For example
my search text is ' john' then my query is by using elasticsearch java api

QueryBuilder queryBuilderForUserSearch = QueryBuilders.fieldQuery("_all",
"" + q + "");

 It's working fine. But when I am trying to search with special 

character text like 'john-son' by this time it it returns zero records.
Can anybody please help me why it's happens and please provide the query
for select text with special characters also. I am really thankful to
them.

Thanks in advance.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/d40fd5c8-ffa5-4fe5-ba99-dc6988fe6559%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/71f0063e-5192-4332-9398-a560d2bb3002%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Sir thanks for instant response, yes there is no necessity of "*" + q

  • "*" just " q " is enough. Present I am using standard-analyzer. Can you
    please help to come out of this problem.But it's(john-son) working
    properly on particular field search but not working "_all " field search.

On Friday, January 24, 2014 7:16:28 PM UTC+5:30, Itamar Syn-Hershko wrote:

This is because "john-son" is most likely being broken down to two terms,
"john" and "son". What analyzer is being defined on your field?

Also note the "" + q + "" thing isn't necessary, this isn't SQL here

--

Itamar Syn-Hershko
http://code972.com | @synhershko https://twitter.com/synhershko
Freelance Developer & Consultant
Author of RavenDB in Action http://manning.com/synhershko/

On Fri, Jan 24, 2014 at 3:04 PM, <purn...@gmail.com <javascript:>> wrote:

Hi everybody good afternoon, Please help me to come out of this problem.
I spent so much time to resolve this issue but I am not able to succeed.

        I have two users in my db collection and those names are 

'john' and 'john-son' , now I am trying to select all records which are
matching with my search text among all fields of db collection. For example
my search text is ' john' then my query is by using elasticsearch java api

QueryBuilder queryBuilderForUserSearch = QueryBuilders.fieldQuery("_all",
"" + q + "");

 It's working fine. But when I am trying to search with special 

character text like 'john-son' by this time it it returns zero records.
Can anybody please help me why it's happens and please provide the query
for select text with special characters also. I am really thankful to
them.

Thanks in advance.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/d40fd5c8-ffa5-4fe5-ba99-dc6988fe6559%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/99c8cd70-0229-4589-a477-28664fb9e88f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.