Search problem with restapi?

curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '
{
"tweet" : {
"user" : "arden",
"sortid": "2",
"postDate" : "2009-11-15T14:12:12",
"message" : "trying out Elastic Search"
}
}'

curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '
{
"tweet" : {
"user" : "arden",
"sortid": "1",
"postDate" : "2009-11-15T14:12:12",
"message" : "trying out Elastic Search"
}
}'

curl -XGET 'http://localhost:9200/twitter/tweet/_search?q=+user:tujiao
+sortid:2&default_operator=AND&fields=user,sortid'

but the search results are:

{"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":
2,"hits":[{"_index":"twitter","_type":"tweet","_id":"5"},
{"_index":"twitter","_type":"tweet","_id":"9"}]}}

that the user,sortid fields not in search results?

Not sure I understand the example. You index two documents with id 1, and
you run a query and get back ids 5 and 9? Have they been indexed with the
proper data? Also, are you by any change disabling _source in the mapping?

-shay.banon

On Tue, May 18, 2010 at 5:29 AM, 曹江华 tujiao.com@gmail.com wrote:

curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '
{
"tweet" : {
"user" : "arden",
"sortid": "2",
"postDate" : "2009-11-15T14:12:12",
"message" : "trying out Elastic Search"
}
}'

curl -XPUT 'http://localhost:9200/twitter/tweet/1' -d '
{
"tweet" : {
"user" : "arden",
"sortid": "1",
"postDate" : "2009-11-15T14:12:12",
"message" : "trying out Elastic Search"
}
}'

curl -XGET 'http://localhost:9200/twitter/tweet/_search?q=+user:tujiao
+sortid:2&default_operator=AND&fields=user,sortid'

but the search results are:

{"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":
2,"hits":[{"_index":"twitter","_type":"tweet","_id":"5"},
{"_index":"twitter","_type":"tweet","_id":"9"}]}}

that the user,sortid fields not in search results?