{"action":"closed","issue":{"url":"https://api.github.com/repos/olivere/elastic/issues/731","repository_url":"https://api.github.com/repos/olivere/elastic","labels_url":"https://api.github.com/repos/olivere/elastic/issues/731/labels{/name}","comments_url":"https://api.github.com/repos/olivere/elastic/issues/731/comments","events_url":"https://api.github.com/repos/olivere/elastic/issues/731/events","html_url":"https://github.com/olivere/elastic/issues/731","id":305597265,"number":731,"title":"Fielddata error when sorting the rows from the index","user":{"login":"kgrvamsi","id":1199031,"avatar_url":"https://avatars3.githubusercontent.com/u/1199031?v=4","gravatar_id":"","url":"https://api.github.com/users/kgrvamsi","html_url":"https://github.com/kgrvamsi","followers_url":"https://api.github.com/users/kgrvamsi/followers","following_url":"https://api.github.com/users/kgrvamsi/following{/other_user}","gists_url":"https://api.github.com/users/kgrvamsi/gists{/gist_id}","starred_url":"https://api.github.com/users/kgrvamsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kgrvamsi/subscriptions","organizations_url":"https://api.github.com/users/kgrvamsi/orgs","repos_url":"https://api.github.com/users/kgrvamsi/repos","events_url":"https://api.github.com/users/kgrvamsi/events{/privacy}","received_events_url":"https://api.github.com/users/kgrvamsi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-15T15:19:35Z","updated_at":"2018-03-15T16:15:45Z","closed_at":"2018-03-15T16:15:44Z","author_association":"NONE","body":"Please use the following questions as a guideline to help me answer\r\nyour issue/question without further inquiry. Thank you.\r\n\r\n### Which version of Elastic are you using?\r\n\r\n[ ] elastic.v2 (for Elasticsearch 1.x)\r\n[ ] elastic.v3 (for Elasticsearch 2.x)\r\n[* ] elastic.v5 (for Elasticsearch 5.x)  -->Elastic Search: 5.6.8\r\n[ ] elastic.v6 (for Elasticsearch 6.x)\r\n\r\n### Please describe the expected behavior\r\n\r\nWas trying to execute the following code \r\n\r\n```\r\nhostquery := elastic.NewBoolQuery().Must(elastic.NewTermQuery(\"last_updated\", date))\r\n\tres, err := eclient.Search().\r\n\t\tIndex(\"testing.inventoryhosts\").\r\n\t\tType(\"InventoryHosts\").\r\n\t\tQuery(hostquery).\r\n\t\tFrom(0).Size(6000).\r\n\t\tPretty(true).\r\n\t\tSort(\"last_updated\", true).\r\n\t\tDo(ctx)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n```\r\nand i get the following error\r\n\r\n![image](https://user-images.githubusercontent.com/1199031/37472183-74d001a0-2839-11e8-8609-127edeb5f25e.png)\r\n\r\nIndex details for the field last_updated\r\n\r\n![image](https://user-images.githubusercontent.com/1199031/37472211-8a17b92c-2839-11e8-94c6-531c7ea923ea.png)\r\n\r\n@olivere can we have fielddata set to true?i was checking some information from the elasticsearch docs and they say that execution of the query based on the fielddata happens from the heap memory and it is not recommended way but can use the keyword instead of the keeping fielddata as true.\r\n\r\nReference url: \r\nhttps://www.elastic.co/guide/en/elasticsearch/reference/current/fielddata.html\r\n\r\n``\r\nInstead, text fields use a query-time in-memory data structure called fielddata. This data structure is built on demand the first time that a field is used for aggregations, sorting, or in a script. It is built by reading the entire inverted index for each segment from disk, inverting the term ↔︎ document relationship, and storing the result in memory, in the JVM heap.\r\n``\r\n\r\nCan you please suggest me a way on how to achieve this fetching around 6000+ records from a particular index(looking out for a efficient way).Any code examples will help\r\n\r\n"}}
{"actor":{"display_login":"olivere"}}