Searching in case of leading wildcard searching

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Searching in case of leading wildcard searching

Ankit Jain
Hi All,

We have field col1 which contains values in below pattern.

aa:bb:cc
aa:ee:ff
aa:dd:gg

We are using QueryString query to search the record.

If we are searching for *a:bb:cc , then query is returning all the above three records, but the expected record in only aa:bb:cc one. Even query is returning records which contains a, aa, aaa, etc.

Below is the query we are using:

String query = "{\"query\" : "
                                            + QueryBuilders
                                                    .queryString(
                                                            "col1"
                                                                    + ":"
                                                                    + input

                                                    )
                                                    .analyzeWildcard(true)
                                                    .defaultOperator(
                                                            Operator.AND)
                                                    .toString() + "}";

Regards,
Ankit Jain



--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Searching in case of leading wildcard searching

Ankit Jain
Hi All,
 
If I am searching for aa:bb:cc, then query is returning exactly one record (expected behaviour).
If I am searching for *a:bb:cc, then query is returning more than expected results (unexpected behaviour).
 
We are using QueryString Query.
 
Regards,
Ankit Jain
 
 
 
On Wednesday, 18 September 2013 19:03:58 UTC+5:30, Ankit Jain wrote:
Hi All,

We have field col1 which contains values in below pattern.

aa:bb:cc
aa:ee:ff
aa:dd:gg

We are using QueryString query to search the record.

If we are searching for *a:bb:cc , then query is returning all the above three records, but the expected record in only aa:bb:cc one. Even query is returning records which contains a, aa, aaa, etc.

Below is the query we are using:

String query = "{\"query\" : "
                                            + QueryBuilders
                                                    .queryString(
                                                            "col1"
                                                                    + ":"
                                                                    + input

                                                    )
                                                    .analyzeWildcard(true)
                                                    .defaultOperator(
                                                            Operator.AND)
                                                    .toString() + "}";

Regards,
Ankit Jain



--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.