Wildcard query not working


(Jack Park) #1

Simple question from a beginner.
I store a document that looks like this:
{"locator":"CO2.CausalAssociation.ClimateChange",
"nameString":"CO2 causes Climate Change",
"instanceOf":"AssociationType",
"sourceTopic":"CO2",
"targetTopic":"ClimateChange"
}

and can prove it is there (that query brought up with a match query.

Using QueryBuilders, I get this query string

{
"wildcard" : {
"locator" : {
"wildcard" : "CO2.CausalAssociation*"
}
}

Earlier, I tried the simplest possible string, as suggested in the ES
documentation:

{"wildcard": {"locator":"CO2.CausalAssociation*"}}

Both query strings fail to match the given document.

In my code, I do not add any mappings to the index as I create. I am
down to wondering why match will work, but wildcard will not.

Thanks in advance for any ideas.

Jack

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


(David Pilato) #2

Probably because your fields are analyzed (standard analyzer by default) and wildcard query are not analyzed.

You should perhaps not analyze your fields.

That said, wildcard queries are slow. You should consider ngrams.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 24 nov. 2013 à 19:18, Jack Park jackpark@topicquests.org a écrit :

Simple question from a beginner.
I store a document that looks like this:
{"locator":"CO2.CausalAssociation.ClimateChange",
"nameString":"CO2 causes Climate Change",
"instanceOf":"AssociationType",
"sourceTopic":"CO2",
"targetTopic":"ClimateChange"
}

and can prove it is there (that query brought up with a match query.

Using QueryBuilders, I get this query string

{
"wildcard" : {
"locator" : {
"wildcard" : "CO2.CausalAssociation*"
}
}

Earlier, I tried the simplest possible string, as suggested in the ES
documentation:

{"wildcard": {"locator":"CO2.CausalAssociation*"}}

Both query strings fail to match the given document.

In my code, I do not add any mappings to the index as I create. I am
down to wondering why match will work, but wildcard will not.

Thanks in advance for any ideas.

Jack

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


(Jack Park) #3

That helps. As a beginner, I presume that means I must put a map in
which says not to analyize, or to generate an ngrams.

Thanks!

On Sun, Nov 24, 2013 at 10:30 AM, David Pilato david@pilato.fr wrote:

Probably because your fields are analyzed (standard analyzer by default) and wildcard query are not analyzed.

You should perhaps not analyze your fields.

That said, wildcard queries are slow. You should consider ngrams.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 24 nov. 2013 à 19:18, Jack Park jackpark@topicquests.org a écrit :

Simple question from a beginner.
I store a document that looks like this:
{"locator":"CO2.CausalAssociation.ClimateChange",
"nameString":"CO2 causes Climate Change",
"instanceOf":"AssociationType",
"sourceTopic":"CO2",
"targetTopic":"ClimateChange"
}

and can prove it is there (that query brought up with a match query.

Using QueryBuilders, I get this query string

{
"wildcard" : {
"locator" : {
"wildcard" : "CO2.CausalAssociation*"
}
}

Earlier, I tried the simplest possible string, as suggested in the ES
documentation:

{"wildcard": {"locator":"CO2.CausalAssociation*"}}

Both query strings fail to match the given document.

In my code, I do not add any mappings to the index as I create. I am
down to wondering why match will work, but wildcard will not.

Thanks in advance for any ideas.

Jack

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


(Jack Park) #4

An experimental solution was simply to go in and create a mapping for
the affected fields and set them to not-analyzed. I learned the hard
way that the Java API for setting mappings wants the index type; I am
now wondering how to do that across all possible types, and, for that
matter, across all possible indexes in a node.

On Sun, Nov 24, 2013 at 10:33 AM, Jack Park jackpark@topicquests.org wrote:

That helps. As a beginner, I presume that means I must put a map in
which says not to analyize, or to generate an ngrams.

Thanks!

On Sun, Nov 24, 2013 at 10:30 AM, David Pilato david@pilato.fr wrote:

Probably because your fields are analyzed (standard analyzer by default) and wildcard query are not analyzed.

You should perhaps not analyze your fields.

That said, wildcard queries are slow. You should consider ngrams.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 24 nov. 2013 à 19:18, Jack Park jackpark@topicquests.org a écrit :

Simple question from a beginner.
I store a document that looks like this:
{"locator":"CO2.CausalAssociation.ClimateChange",
"nameString":"CO2 causes Climate Change",
"instanceOf":"AssociationType",
"sourceTopic":"CO2",
"targetTopic":"ClimateChange"
}

and can prove it is there (that query brought up with a match query.

Using QueryBuilders, I get this query string

{
"wildcard" : {
"locator" : {
"wildcard" : "CO2.CausalAssociation*"
}
}

Earlier, I tried the simplest possible string, as suggested in the ES
documentation:

{"wildcard": {"locator":"CO2.CausalAssociation*"}}

Both query strings fail to match the given document.

In my code, I do not add any mappings to the index as I create. I am
down to wondering why match will work, but wildcard will not.

Thanks in advance for any ideas.

Jack

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


(system) #5