我有一个文件如何在elasticsearch上的特定字段上使用排序我的查询如下{ "sort":{ "name":"desc" }, "from":10, "size":149, "query":{ "match_all":{ } }}我收到错误Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [name] in order to load field data by uninverting the inverted index. Note that this can use significant memory.')\"}" }我的索引名称是 data_new下面是插入索引的代码test = [ {'id':1,'name': 'Cost Accounting 400', 'professor': ['Bill Cage', 'accounting']}, { 'id':2, 'name': 'Computer Internals 250', 'professor': ['Gregg Payne', 'engineering']}, {'id':3, 'name': 'Accounting Info Systems 350', 'professor': ['Bill Cage', 'accounting']}, {'id':4,'name': 'Tax Accounting 200', 'professor': ['Thomas Baszo', 'finance']}, {'id':5,'name': 'Capital Markets 350', 'professor': ['Thomas Baszo', 'finance']}, {'id':6,'name': 'Theatre 410', 'professor': ['Sebastian Hern', 'art']}, {'id':7,'name': 'Accounting 101', 'professor': ['Thomas Baszo', 'finance']}, {'id':8,'name': 'Marketing 101', 'professor': ['William Smith', 'finance']}, {'id':8,'name': 'Anthropology 230', 'professor': ['Devin Cranford', 'history']}, {'id':10, 'name': 'Computer Science 101', 'professor': ['Gregg Payne', 'engineering']}]from elasticsearch import Elasticsearchimport jsones = Elasticsearch()es.indices.create(index='data_new', ignore=400)for e in test: es.index(index="data_new", body=e, id=e['id'])search = es.search(index="data_new", body={"from" : 0, "size" : 2,"query": {"match_all": {}}})search['hits']['hits']预计出我的第一个预期输出>我需要对输出进行name排序第二个预期输出 > 相对于namethen排序id如何进行修改search = es.search(index="data_new", body={"from" : 0, "size" : 2,"query": {"match_all": {}}})https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-request-sort.html我浏览了没有帮助的网址
查看完整描述