# Different results with command line search vs JSON file based search

**URL:** <https://discuss.elastic.co/t/different-results-with-command-line-search-vs-json-file-based-search/14771>\
**Category:** Elasticsearch\
**Created:** [December 9, 2013, 3:26pm UTC](https://discuss.elastic.co/t/different-results-with-command-line-search-vs-json-file-based-search/14771 "2013-12-09T15:26:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rene\_boucheron](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@rene\_boucheron](https://discuss.elastic.co/u/rene_boucheron)\
**Post date:** [December 9, 2013, 3:26pm UTC](https://discuss.elastic.co/t/different-results-with-command-line-search-vs-json-file-based-search/14771/1 "2013-12-09T15:26:10Z")

</div>

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\*](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](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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [December 10, 2013, 5:15am UTC](https://discuss.elastic.co/t/different-results-with-command-line-search-vs-json-file-based-search/14771/2 "2013-12-10T05:15:18Z")

</div>

A wildcard query does not analyze the term:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

The equivalent query for the first query would be a query\_string query:

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Cheers,

Ivan

On Mon, Dec 9, 2013 at 7:26 AM, [rene.boucheron@googlemail.com](mailto: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](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](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](mailto: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](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](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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![rene\_boucheron](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@rene\_boucheron](https://discuss.elastic.co/u/rene_boucheron)\
**Post date:** [December 10, 2013, 8:35am UTC](https://discuss.elastic.co/t/different-results-with-command-line-search-vs-json-file-based-search/14771/3 "2013-12-10T08:35:29Z")

</div>

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:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](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:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](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](mailto: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](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](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](mailto: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](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](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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:02am UTC](https://discuss.elastic.co/t/different-results-with-command-line-search-vs-json-file-based-search/14771/4 "2017-07-06T02:02:17Z")

</div>


