Ejemplo n.º 1
0
    logger.debug("qdw: count returned as %s" % (count))
    jsonquery={
        "fields":[""], #dont return any of the source
        "size": count, #gets number of files in the profiles dir and set as the max no. results to return
        "query" : {
            "match_all" : {}
        },
        "facets" : {
            "tag" : {
                "terms" : {
                    "field" : path
                }
            }
        }
    }
    raw=dwfuncts.queryer(logger, jsonquery)
    logger.debug("qdw: query returned %s" % (raw))
    mixedlist = raw['facets']['tag']['terms'] #navigate to the terms feild within the results
    array=[]
    for i in range(0,len(mixedlist)):
        temp=[mixedlist[i]["term"],int(mixedlist[i]["count"])]  #organises
        array.append(temp)
    if raw['facets']['tag']['missing'] != 0:
        array.append(["No Data",raw['facets']['tag']['missing']])
    if args.prettyprint:
        print 'Value : Frequency'
        for i in array:
            print i
    else:
        print (json.dumps(array))
Ejemplo n.º 2
0
    count = dwfuncts.indexcount()
    jsonquery={
                "fields":[""], #dont return any of the source
                "size":count, #gets number of files in the profiles dir and set as the max no. results to return
                "query" : {
                    "match_all" : {}
                },
                "facets" : {
                    "tag" : {
                        "terms" : {
                            "field" : path
                        }
                        }
                    }
            }
    raw=dwfuncts.queryer(jsonquery)
    mixedlist = raw['facets']['tag']['terms']   #navigate to the terms feild within the results
    array=[]
    for i in range(0,len(mixedlist)):
        temp=[mixedlist[i]["term"],int(mixedlist[i]["count"])]  #organises
        array.append(temp)
    if raw['facets']['tag']['missing'] != 0:
        array.append(["No Data",raw['facets']['tag']['missing']])
    if args.prettyprint:
        print 'Value : Frequency'
        for i in array:
            print i
    else:
        print (json.dumps(array))
        
elif (args.frequencyofx is not(None)):