# Newbie Q

**URL:** <https://discuss.elastic.co/t/newbie-q/3768>\
**Category:** Elasticsearch\
**Created:** [January 12, 2011, 4:11pm UTC](https://discuss.elastic.co/t/newbie-q/3768 "2011-01-12T16:11:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Svet](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@Svet](https://discuss.elastic.co/u/Svet)\
**Post date:** [January 12, 2011, 4:11pm UTC](https://discuss.elastic.co/t/newbie-q/3768/1 "2011-01-12T16:11:25Z")

</div>

Hi,

Please could someone explain me what is wrong with this:

curl -XGET [http://server:9200/medios/news/\_search](http://server:9200/medios/news/_search) -d '{ "query" :  
{ "term" : { "fuente" : "Avui" } } }'

while in the same time, this works great:

curl -XGET [http://server:9200/medios/news/\_search?q=fuente:Avui](http://server:9200/medios/news/_search?q=fuente:Avui)

I am quite sure that is should be something obvious but ... can't  
figure it out ☹

Thank you!

---

<div class="post-metadata">

**Author:** ![Rich\_Kroll](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rich_kroll/32/3229_2.png) [@Rich\_Kroll](https://discuss.elastic.co/u/Rich_Kroll)\
**Post date:** [January 12, 2011, 4:17pm UTC](https://discuss.elastic.co/t/newbie-q/3768/2 "2011-01-12T16:17:53Z")

</div>

In your get query example you used the "q=" syntax which causes a query  
string search. In your json example you used a term query. Check the search  
docs for query\_string search to see the proper syntax  
On Jan 12, 2011 11:11 AM, "Svet" [svetef@gmail.com](mailto:svetef@gmail.com) wrote:

---

<div class="post-metadata">

**Author:** ![Adriano\_Ferreira](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adriano_ferreira/32/3228_2.png) [@Adriano\_Ferreira](https://discuss.elastic.co/u/Adriano_Ferreira)\
**Post date:** [January 12, 2011, 4:39pm UTC](https://discuss.elastic.co/t/newbie-q/3768/3 "2011-01-12T16:39:58Z")

</div>

On Wed, Jan 12, 2011 at 2:11 PM, Svet [svetef@gmail.com](mailto:svetef@gmail.com) wrote:

> Hi,
> 
> Please could someone explain me what is wrong with this:
> 
> curl -XGET [http://server:9200/medios/news/\_search](http://server:9200/medios/news/_search) -d '{ "query" :  
> { "term" : { "fuente" : "Avui" } } }'
> 
> while in the same time, this works great:
> 
> curl -XGET [http://server:9200/medios/news/\_search?q=fuente:Avui](http://server:9200/medios/news/_search?q=fuente:Avui)
> 
> I am quite sure that is should be something obvious but ... can't  
> figure it out ☹

I think the parameter q=fuente:Avui is equivalent to

{ "query":  
{ "query\_string":  
{ "query": "fuente:Avui"  
}  
}  
}

The "query\_string" is parsed (and analyzed) into something very close to  
your attempt:

{ "query": { "term" : { "fuente": "avui" } } }

My conjecture is that when "fuente:Avui" is parsed, the term "Avui" is  
normalized to lowercase as "avui" – this should be the same which happens  
when you index your documents (because the default query analyzer matches  
the default index analyzer). So the "query\_string" works ok, but not your  
"term" query because that one does not analyze "Avui" and then you have no  
match for this term with an uppercase letter "A".

So I suggest you try "avui" in lowercase at the "term" query. And probably  
someone else in the list may confirm if I got that right.

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [January 12, 2011, 4:47pm UTC](https://discuss.elastic.co/t/newbie-q/3768/4 "2011-01-12T16:47:38Z")

</div>

> My conjecture is that when "fuente:Avui" is parsed, the term "Avui" is  
> normalized to lowercase as "avui" â this should be the same which  
> happens when you index your documents (because the default query  
> analyzer matches the default index analyzer). So the "query\_string"  
> works ok, but not your "term" query because that one does not analyze  
> "Avui" and then you have no match for this term with an uppercase  
> letter "A".
> 
> So I suggest you try "avui" in lowercase at the "term" query. And  
> probably someone else in the list may confirm if I got that right.

exactly right

clint

---

<div class="post-metadata">

**Author:** ![Svet](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@Svet](https://discuss.elastic.co/u/Svet)\
**Post date:** [January 12, 2011, 5:40pm UTC](https://discuss.elastic.co/t/newbie-q/3768/5 "2011-01-12T17:40:06Z")

</div>

Indeed, this was the problem. Thank you @Rich, @Adriano, @Clinton!

On 12 ene, 17:39, Adriano Ferreira [a.r.ferre...@gmail.com](mailto:a.r.ferre...@gmail.com) wrote:

> On Wed, Jan 12, 2011 at 2:11 PM, Svet [sve...@gmail.com](mailto:sve...@gmail.com) wrote:
> 
> > Hi,
> 
> > Please could someone explain me what is wrong with this:
> 
> > curl -XGEThttp://server:9200/medios/news/\_search-d '{ "query" :  
> > { "term" : { "fuente" : "Avui" } } }'
> 
> > while in the same time, this works great:
> 
> > curl -XGEThttp://server:9200/medios/news/\_search?q=fuente:Avui
> 
> > I am quite sure that is should be something obvious but ... can't  
> > figure it out ☹
> 
> I think the parameter q=fuente:Avui is equivalent to
> 
> { "query":  
> { "query\_string":  
> { "query": "fuente:Avui"  
> }  
> }
> 
> }
> 
> The "query\_string" is parsed (and analyzed) into something very close to  
> your attempt:
> 
> { "query": { "term" : { "fuente": "avui" } } }
> 
> My conjecture is that when "fuente:Avui" is parsed, the term "Avui" is  
> normalized to lowercase as "avui" – this should be the same which happens  
> when you index your documents (because the default query analyzer matches  
> the default index analyzer). So the "query\_string" works ok, but not your  
> "term" query because that one does not analyze "Avui" and then you have no  
> match for this term with an uppercase letter "A".
> 
> So I suggest you try "avui" in lowercase at the "term" query. And probably  
> someone else in the list may confirm if I got that right.

---

<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, 4:13am UTC](https://discuss.elastic.co/t/newbie-q/3768/6 "2017-07-06T04:13:59Z")

</div>


