Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full field paths not respected in sort parameters #1226

Closed
clintongormley opened this issue Aug 10, 2011 · 0 comments
Closed

Full field paths not respected in sort parameters #1226

clintongormley opened this issue Aug 10, 2011 · 0 comments

Comments

@clintongormley
Copy link

When sorting by type.field instead of field, the sort parameter seems to be ignored

# [Wed Aug 10 15:28:14 2011] Protocol: http, Server: 192.168.5.103:9200
curl -XPUT 'http://127.0.0.1:9200/foo/?pretty=1'  -d '
{
   "mappings" : {
      "bar" : {
         "properties" : {
            "text" : {
               "index" : "not_analyzed",
               "type" : "string"
            }
         }
      }
   }
}
'

# [Wed Aug 10 15:28:14 2011] Response:
# {
#    "ok" : true,
#    "acknowledged" : true
# }

# [Wed Aug 10 15:28:25 2011] Protocol: http, Server: 192.168.5.103:9200
curl -XPOST 'http://127.0.0.1:9200/foo/bar?pretty=1'  -d '
{
   "text" : "foo"
}
'

# [Wed Aug 10 15:28:25 2011] Response:
# {
#    "ok" : true,
#    "_index" : "foo",
#    "_id" : "K91kSFDQRUW7IYszBQVHjQ",
#    "_type" : "bar",
#    "_version" : 1
# }

# [Wed Aug 10 15:28:28 2011] Protocol: http, Server: 192.168.5.103:9200
curl -XPOST 'http://127.0.0.1:9200/foo/bar?pretty=1'  -d '
{
   "text" : "bar"
}
'

# [Wed Aug 10 15:28:28 2011] Response:
# {
#    "ok" : true,
#    "_index" : "foo",
#    "_id" : "ZiQZ_FbQSxGXLY0YwvjWgw",
#    "_type" : "bar",
#    "_version" : 1
# }

This works:

# [Wed Aug 10 15:28:34 2011] Protocol: http, Server: 192.168.5.103:9200
curl -XGET 'http://127.0.0.1:9200/foo/bar/_search?pretty=1'  -d '
{
   "sort" : {
      "text" : "asc"
   }
}
'

# [Wed Aug 10 15:28:34 2011] Response:
# {
#    "hits" : {
#       "hits" : [
#          {
#             "_source" : {
#                "text" : "bar"
#             },
#             "sort" : [
#                "bar"
#             ],
#             "_score" : null,
#             "_index" : "foo",
#             "_id" : "ZiQZ_FbQSxGXLY0YwvjWgw",
#             "_type" : "bar"
#          },
#          {
#             "_source" : {
#                "text" : "foo"
#             },
#             "sort" : [
#                "foo"
#             ],
#             "_score" : null,
#             "_index" : "foo",
#             "_id" : "K91kSFDQRUW7IYszBQVHjQ",
#             "_type" : "bar"
#          }
#       ],
#       "max_score" : null,
#       "total" : 2
#    },
#    "timed_out" : false,
#    "_shards" : {
#       "failed" : 0,
#       "successful" : 5,
#       "total" : 5
#    },
#    "took" : 1
# }

This doesn't:

# [Wed Aug 10 15:28:38 2011] Protocol: http, Server: 192.168.5.103:9200
curl -XGET 'http://127.0.0.1:9200/foo/bar/_search?pretty=1'  -d '
{
   "sort" : {
      "bar.text" : "asc"
   }
}
'

# [Wed Aug 10 15:28:38 2011] Response:
# {
#    "hits" : {
#       "hits" : [
#          {
#             "_source" : {
#                "text" : "foo"
#             },
#             "sort" : [
#                null
#             ],
#             "_score" : null,
#             "_index" : "foo",
#             "_id" : "K91kSFDQRUW7IYszBQVHjQ",
#             "_type" : "bar"
#          },
#          {
#             "_source" : {
#                "text" : "bar"
#             },
#             "sort" : [
#                null
#             ],
#             "_score" : null,
#             "_index" : "foo",
#             "_id" : "ZiQZ_FbQSxGXLY0YwvjWgw",
#             "_type" : "bar"
#          }
#       ],
#       "max_score" : null,
#       "total" : 2
#    },
#    "timed_out" : false,
#    "_shards" : {
#       "failed" : 0,
#       "successful" : 5,
#       "total" : 5
#    },
#    "took" : 2
# }
@kimchy kimchy closed this as completed in 745b8cb Aug 10, 2011
mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
williamrandolph pushed a commit to williamrandolph/elasticsearch that referenced this issue Jun 4, 2020
jev001 pushed a commit to jev001/elasticsearch that referenced this issue Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants