Help sorting on fields with large amounts of data


(Andrew Dasilva) #1

Hello all,

I have a question regarding sorting by an attribute of my document.
Sorting generally works as I would like but for some records this particular field have extremely large volume of data sorting does not work, it considers this field as being null.

This is my mapping property, I have included the keyword field.
</>
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
</>

This the sort part of my query. I use keyword
</>
{
"sort": [
{
"name.keyword": {
"order": "asc",
"missing": "_last"
}
}
]
}
</>

Here is a sample response that showcases the issue i am experiencing.
</>
{
"hits": [
{
"_index": "repertoire-20180307",
"_type": "candidate",
"_id": "419983372",
"_score": null,
"_routing": "474747071",
"_parent": "474747071",
"_source": {
"name": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
},
"sort": [
null
]
},
{
"_index": "repertoire-20180307",
"_type": "candidate",
"_id": "419983372",
"_score": null,
"_routing": "474747071",
"_parent": "474747071",
"_source": {
"name": null
},
"sort": [
null
]
},
{
"_index": "repertoire-20180307",
"_type": "candidate",
"_id": "419983372",
"_score": null,
"_routing": "474747071",
"_parent": "474747071",
"_source": {
"name": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
},
"sort": [
null
]
},
{
"_index": "repertoire-20180307",
"_type": "candidate",
"_id": "419983372",
"_score": null,
"_routing": "474747071",
"_parent": "474747071",
"_source": {
"name": "andrew"
},
"sort": [
"andrew"
]
},
{
"_index": "repertoire-20180307",
"_type": "candidate",
"_id": "419983372",
"_score": null,
"_routing": "474747071",
"_parent": "474747071",
"_source": {
"name": "tom"
},
"sort": [
"tom"
]
}
]
}
</>

Any suggestions on how I can still get sorting to work on the larger field volumes? Can i configure elastic search to sort only on a subset or the data within the field? I see the ignore above value 256 does not work.


(system) #2

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