Query returning only ids


(Ridvan Gyundogan) #1

Hello All, I am trying to run a query which returns only the id's for
a given index without the source but I am unable to do it.

I try with a query like this:

{
"fields": [
"price",
"_id"
],
"_source": {
"enabled": false
},
"query": {
"match_all": {}
}
}

I know that I can disable the source field generally but we need it
for other queries.


(Jürgen kartnaller) #2

Just use fields=[]

On Fri, Aug 12, 2011 at 12:32 PM, Ridvan Gyundogan ridvansg@gmail.comwrote:

Hello All, I am trying to run a query which returns only the id's for
a given index without the source but I am unable to do it.

I try with a query like this:

{
"fields": [
"price",
"_id"
],
"_source": {
"enabled": false
},
"query": {
"match_all": {}
}
}

I know that I can disable the source field generally but we need it
for other queries.

--
http://www.sfgdornbirn.at
http://www.mcb-bregenz.at


(roger-2) #3

Hi Jürgen

It's a long time ago, but nice to meet you here again!

Let me know if you need an elasticsearch stub server setup
for python unit testing!

Regards
Roger Ineichen

-----Ursprüngliche Nachricht-----
Von: elasticsearch@googlegroups.com
[mailto:elasticsearch@googlegroups.com] Im
Auftrag von Jürgen kartnaller
Gesendet: Freitag, 12. August 2011 14:27
An: elasticsearch@googlegroups.com
Betreff: Re: Query returning only ids

Just use fields=[]

On Fri, Aug 12, 2011 at 12:32 PM, Ridvan Gyundogan ridvansg@gmail.com
wrote:

Hello All, I am trying to run a query which returns only the id's
for
a given index without the source but I am unable to do it.

I try with a query like this:

{
"fields": [
"price",
"_id"
],
"_source": {
"enabled": false
},
"query": {
"match_all": {}
}
}

I know that I can disable the source field generally but we need it
for other queries.

--
http://www.sfgdornbirn.at
http://www.mcb-bregenz.at


(Ridvan Gyundogan) #4

Thanks Jürgen,
I actually tried fields but was putting it inside the query, the
following worked:

curl -XGET http://localhost:9200/giftsplusindex/giftsplusproduct/_search?pretty=true
-d '{
"fields" : ["id", "price"],
"query" : {
"match_all": {}
}
}'

On Aug 12, 3:33 pm, "Roger" d...@projekt01.ch wrote:

Hi Jürgen

It's a long time ago, but nice to meet you here again!

Let me know if you need an elasticsearch stub server setup
for python unit testing!

Regards
Roger Ineichen

-----Ursprüngliche Nachricht-----
Von: elasticsearch@googlegroups.com

[mailto:elasticsearch@googlegroups.com] Im

Auftrag von Jürgen kartnaller
Gesendet: Freitag, 12. August 2011 14:27
An: elasticsearch@googlegroups.com
Betreff: Re: Query returning only ids

Just use fields=[]

On Fri, Aug 12, 2011 at 12:32 PM, Ridvan Gyundogan ridva...@gmail.com
wrote:

Hello All, I am trying to run a query which returns only the id's
for
a given index without the source but I am unable to do it.

I try with a query like this:

{
"fields": [
"price",
"_id"
],
"_source": {
"enabled": false
},
"query": {
"match_all": {}
}
}

I know that I can disable the source field generally but we need it
for other queries.

--
http://www.sfgdornbirn.at
http://www.mcb-bregenz.at


(system) #5