{ "error":{ "root_cause":[ { "type":"illegal_argument_exception", "reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [title] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead." } ], "type":"search_phase_execution_exception", "reason":"all shards failed", "phase":"query", "grouped":true, "failed_shards":[ { "shard":0, "index":"movies", "node":"6pljLZ0vQQKObirnkOOsnw", "reason":{ "type":"illegal_argument_exception", "reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [title] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead." } } ], "caused_by":{ "type":"illegal_argument_exception", "reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [title] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.", "caused_by":{ "type":"illegal_argument_exception", "reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [title] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead." } } }, "status":400 }
{ "error":{ "root_cause":[ { "type":"illegal_argument_exception", "reason":"Can't load fielddata on [username] because fielddata is unsupported on fields of type [keyword]. Use doc values instead." } ], "type":"search_phase_execution_exception", "reason":"all shards failed", "phase":"query", "grouped":true, "failed_shards":[ { "shard":0, "index":"test_doc_values", "node":"6pljLZ0vQQKObirnkOOsnw", "reason":{ "type":"illegal_argument_exception", "reason":"Can't load fielddata on [username] because fielddata is unsupported on fields of type [keyword]. Use doc values instead." } } ], "caused_by":{ "type":"illegal_argument_exception", "reason":"Can't load fielddata on [username] because fielddata is unsupported on fields of type [keyword]. Use doc values instead.", "caused_by":{ "type":"illegal_argument_exception", "reason":"Can't load fielddata on [username] because fielddata is unsupported on fields of type [keyword]. Use doc values instead." } } }, "status":400 }
{ "error":{ "root_cause":[ { "type":"illegal_argument_exception", "reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [10010]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting." } ], "type":"search_phase_execution_exception", "reason":"all shards failed", "phase":"query", "grouped":true, "failed_shards":[ { "shard":0, "index":"movies", "node":"6pljLZ0vQQKObirnkOOsnw", "reason":{ "type":"illegal_argument_exception", "reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [10010]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting." } } ], "caused_by":{ "type":"illegal_argument_exception", "reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [10010]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting.", "caused_by":{ "type":"illegal_argument_exception", "reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [10010]. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the [index.max_result_window] index level setting." } } }, "status":400 }
分页与遍历-scroll
遍历文档集的api ,以快照的方式来避免深度分页的问题
不能用来做实时搜索,因为数据不是实时的
尽量不要使用复杂的sort条件,使用_doc最高效
使用稍嫌复杂
第一步需要发起1个scroll search:
es在收到该请求后会根据查询条件创建文档Id合集的快照
request
1 2 3 4 5
GET movies/_search?scroll=5m { "size": 1 } 5m至快照有效时常,size返回条数