我正在尝试对莎士比亚数据集运行聚合查询

时间:2019-04-03 19:44:19

标签: elasticsearch

我正在尝试对莎士比亚样本数据集运行聚合查询。我是ES的新手,但这似乎是正确的,应该返回一个唯一播放的列表,但是当我在flask应用程序中运行此查询时,它不会返回任何内容。不知道我在做什么错。任何帮助将不胜感激:)

我要运行的查询:

{
        "aggs": {
            "play_name": {
                "terms": {
                    "field": "play_name",
                    "size": 200
                }
            },
            "play_count": {
                "cardinality": {
                    "field": "play_name"

                }
            }
        },
}

莎士比亚数据集摘要:

{"index":{"_index":"shakespeare","_type":"line","_id":2}}
{"line_id":3,"play_name":"Henry IV","speech_number":"","line_number":"","speaker":"","text_entry":"Enter KING HENRY, LORD JOHN OF LANCASTER, the EARL of WESTMORELAND, SIR WALTER BLUNT, and others"}
{"index":{"_index":"shakespeare","_type":"line","_id":3}}
{"line_id":4,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.1","speaker":"KING HENRY IV","text_entry":"So shaken as we are, so wan with care,"}
{"index":{"_index":"shakespeare","_type":"line","_id":4}}
{"line_id":5,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.2","speaker":"KING HENRY IV","text_entry":"Find we a time for frighted peace to pant,"}
{"index":{"_index":"shakespeare","_type":"line","_id":5}}
{"line_id":6,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.3","speaker":"KING HENRY IV","text_entry":"And breathe short-winded accents of new broils"}
{"index":{"_index":"shakespeare","_type":"line","_id":6}}
{"line_id":7,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.4","speaker":"KING HENRY IV","text_entry":"To be commenced in strands afar remote."}
{"index":{"_index":"shakespeare","_type":"line","_id":7}}
{"line_id":8,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.5","speaker":"KING HENRY IV","text_entry":"No more the thirsty entrance of this soil"}
{"index":{"_index":"shakespeare","_type":"line","_id":8}}
{"line_id":9,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.6","speaker":"KING HENRY IV","text_entry":"Shall daub her lips with her own childrens blood;"}
{"index":{"_index":"shakespeare","_type":"line","_id":9}}
{"line_id":10,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.7","speaker":"KING HENRY IV","text_entry":"Nor more shall trenching war channel her fields,"}
{"index":{"_index":"shakespeare","_type":"line","_id":10}}
{"line_id":11,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.8","speaker":"KING HENRY IV","text_entry":"Nor bruise her flowerets with the armed hoofs"}
{"index":{"_index":"shakespeare","_type":"line","_id":11}}
{"line_id":12,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.9","speaker":"KING HENRY IV","text_entry":"Of hostile paces: those opposed eyes,"}
{"index":{"_index":"shakespeare","_type":"line","_id":12}}
{"line_id":13,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.10","speaker":"KING HENRY IV","text_entry":"Which, like the meteors of a troubled heaven,"}
{"index":{"_index":"shakespeare","_type":"line","_id":13}}
{"line_id":14,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.11","speaker":"KING HENRY IV","text_entry":"All of one nature, of one substance bred,"}
{"index":{"_index":"shakespeare","_type":"line","_id":14}}
{"line_id":15,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.12","speaker":"KING HENRY IV","text_entry":"Did lately meet in the intestine shock"}
{"index":{"_index":"shakespeare","_type":"line","_id":15}}
{"line_id":16,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.13","speaker":"KING HENRY IV","text_entry":"And furious close of civil butchery"}
{"index":{"_index":"shakespeare","_type":"line","_id":16}}
{"line_id":17,"play_name":"Henry IV","speech_number":1,"line_number":"1.1.14","speaker":"KING HENRY IV","text_entry":"Shall now, in mutual well-beseeming ranks,"}

0 个答案:

没有答案