Nested Sort Not Working with query_string?


(Ryan Jaeger) #1

Thoughts on this?

When running this query:

{
"query": {
"bool": {
"must": [
{

      "query_string": {
        "query" : "*"
      }
    }]  
  }
}

,
"sort": [
{
"values.value.keyword" : {
"order" : "asc",
"nested_path": "values",
"nested_filter" : {
"bool" : {
"must": [
{
"match": {
"values.name" : { "query" : "CreatedBy" }
}
}
]
}

    }
  }
}
]

}

The results are: (look for "<------" for comments)
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 3,
"max_score": 4.8158913,
"hits": [
{
"_index": "contentobjecttest",
"_type": "contentobject",
"_id": "AV0aIcAmTKNRtcPZ6Eup",
"_score": 4.8158913,
"_source": {
"teamId": "70b57943-c230-445e-925e-4a214a833ef9",
"uniqueId": "000000001A",
"values": [
{
"name": "Name",
"value": "Test document.pdf",
"objectPropertyId": "0cff2f1a-fb89-4683-b405-7dc67721892b",
"propertyType": "string"
},
{
"name": "CreatedDate",
"value": "2017-06-26",
"objectPropertyId": "cade3458-a379-4175-ae89-3f276b714567",
"propertyType": "Date"
},
{
"name": "CreatedBy",
"value": "rjaeger@test.com", <---------- NOT asc
"objectPropertyId": "e8a41948-1a29-47f3-931f-8a418627ac38",
"propertyType": "string"
},
{
"name": "Version",
"value": "1",
"objectPropertyId": "de5eddb0-3538-458d-a05b-60086d93d17c",
"propertyType": "int"
}
]
}
},
{
"_index": "contentobjecttest",
"_type": "contentobject",
"_id": "AV0aIcBVTKNRtcPZ6Euq",
"_score": 3.2834144,
"_source": {
"teamId": "70b57943-c230-445e-925e-4a214a833ef9",
"uniqueId": "000000001E",
"values": [
{
"name": "Name",
"value": "Test document Ryan.pdf",
"objectPropertyId": "c9b69f9e-82da-4064-8a43-8039882fbdb1",
"propertyType": "string"
},
{
"name": "CreatedDate",
"value": "2017-04-07",
"objectPropertyId": "eeab8d9c-1476-40a1-a924-f3edfa8d6dc7",
"propertyType": "Date"
},
{
"name": "CreatedBy",
"value": "rjaeger@test.com", <---------- NOT asc
"objectPropertyId": "b367deee-9e90-4494-af46-b313132dac1f",
"propertyType": "string"
},
{
"name": "Version",
"value": "25",
"objectPropertyId": "26cb0196-a992-40f1-8f6e-cb65d1112d2a",
"propertyType": "int"
}
]
}
},
{
"_index": "contentobjecttest",
"_type": "contentobject",
"_id": "AV0aIcDiTKNRtcPZ6Euu",
"_score": 3.0726933,
"_source": {
"teamId": "2e278344-7871-4ca1-bd6a-0cea3d746fda",
"uniqueId": "000000002C",
"productVersion": "1.1",
"values": [
{
"name": "Name",
"value": "Hello World.docx",
"objectPropertyId": "e6d0de0d-3bf8-41cc-a8ca-0ff2def3628d",
"propertyType": "string"
},
{
"name": "CreatedDate",
"value": "2017-05-07",
"objectPropertyId": "296bacc7-fb26-46cf-b821-49a9d500efad",
"propertyType": "Date"
},
{
"name": "CreatedBy",
"value": "jkennedy@test.com", <---------- NOT asc
"objectPropertyId": "18d3a146-6ca9-41c2-9620-05226090237d",
"propertyType": "string"
},
{
"name": "Version",
"value": "1",
"objectPropertyId": "37e9ee15-a642-4386-aea8-e57873d07c0f",
"propertyType": "int"
}
]
}
}
]
}
}

Ideas?


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.