Different results with command line search vs JSON file based search


(rene.boucheron) #1

Hi,

Please help me understand my mistake here.

I have a keyword field KEYWORDS the content for which is getting lower
cased during indexing. I used the Inquisitor plugin to see if the analyzers
behave like they should.

When searching, this command

curl -XPOST
'http://localhost:9200/index/_search?pretty=1&fields=title&q=KEYWORDS:KEYW*'

yields hits.

But when I execute

curl -XPOST 'http://localhost:9200/index/_search?pretty=1&fields=title' -d
@search_request.json

with search_request.json:

{
"query": {
"wildcard": {
"KEYWORDS": "KEYW*"
}
}
}

there are no hits. Only when I lower case the term in the JSON file
to"keyw*" manually there are results.

Please, what is the difference between the two search requests?

Thank you,
Rene

--
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/0f46ab7f-2968-48e5-ab96-1639c56b6b0f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Ivan Brusic) #2

A wildcard query does not analyze the term:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html

The equivalent query for the first query would be a query_string query:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html

Cheers,

Ivan

On Mon, Dec 9, 2013 at 7:26 AM, rene.boucheron@googlemail.com wrote:

Hi,

Please help me understand my mistake here.

I have a keyword field KEYWORDS the content for which is getting lower
cased during indexing. I used the Inquisitor plugin to see if the analyzers
behave like they should.

When searching, this command

curl -XPOST '
http://localhost:9200/index/_search?pretty=1&fields=title&q=KEYWORDS:KEYW*
'

yields hits.

But when I execute

curl -XPOST 'http://localhost:9200/index/_search?pretty=1&fields=title'
-d @search_request.json

with search_request.json:

{
"query": {
"wildcard": {
"KEYWORDS": "KEYW*"
}
}
}

there are no hits. Only when I lower case the term in the JSON file
to"keyw*" manually there are results.

Please, what is the difference between the two search requests?

Thank you,
Rene

--
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/0f46ab7f-2968-48e5-ab96-1639c56b6b0f%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/CALY%3DcQDfWyLo0BqO43mKUpW4FNekuO%3Dh%3DAZFeY7eyasqUO-UNA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(rene.boucheron) #3

Thank you, Ivan,

While a wildcard query does not analyze a term, I was under the impressione
that wildcard terms get lowercased nevertheless, courtesy of Lucene.
Probably not true any longer for a long time...

Thanks,
Rene

On Tuesday, December 10, 2013 6:15:18 AM UTC+1, Ivan Brusic wrote:

A wildcard query does not analyze the term:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html

The equivalent query for the first query would be a query_string query:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html

Cheers,

Ivan

On Mon, Dec 9, 2013 at 7:26 AM, <rene.bo...@googlemail.com <javascript:>>wrote:

Hi,

Please help me understand my mistake here.

I have a keyword field KEYWORDS the content for which is getting lower
cased during indexing. I used the Inquisitor plugin to see if the analyzers
behave like they should.

When searching, this command

curl -XPOST '
http://localhost:9200/index/_search?pretty=1&fields=title&q=KEYWORDS:KEYW*
'

yields hits.

But when I execute

curl -XPOST 'http://localhost:9200/index/_search?pretty=1&fields=title'
-d @search_request.json

with search_request.json:

{
"query": {
"wildcard": {
"KEYWORDS": "KEYW*"
}
}
}

there are no hits. Only when I lower case the term in the JSON file
to"keyw*" manually there are results.

Please, what is the difference between the two search requests?

Thank you,
Rene

--
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/0f46ab7f-2968-48e5-ab96-1639c56b6b0f%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/d4d24e0c-0105-456f-af32-6aa54c421c6d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4