Пример #1
0
def upload():
    import datastore.client

    dsurl = 'http://localhost:9200/ds/opendatacensus'
    # dsurl = 'http://datahub.io/api/data/1f7dbeab-b523-4fa4-b9ab-7cfc3bd5e9f7'
    client = datastore.client.DataStoreClient(dsurl)

    print 'Deleting'
    client.delete()
    print 'Done'

    mapping = {
        'properties': {
            'Dataset': {
                'type': 'string',
                'index': 'not_analyzed'
            },
            'Census Country': {
                'type': 'string',
                'index': 'not_analyzed'
            },
        }
    }
    out = client.mapping_update(mapping)
    print out

    print 'Uploading to local'
    client.upload(fp)
    print 'Done'
Пример #2
0
def upload():
    import datastore.client

    dsurl = 'http://localhost:9200/ds/opendatacensus'
    # dsurl = 'http://datahub.io/api/data/1f7dbeab-b523-4fa4-b9ab-7cfc3bd5e9f7'
    client = datastore.client.DataStoreClient(dsurl)


    print 'Deleting'
    client.delete()
    print 'Done'
    
    mapping = {
        'properties': {
            'Dataset': {
                'type': 'string',
                'index': 'not_analyzed'
            },
            'Census Country': {
                'type': 'string',
                'index': 'not_analyzed'
            },
        }
    }
    out = client.mapping_update(mapping)
    print out

    print 'Uploading to local'
    client.upload(fp)
    print 'Done'
Пример #3
0
def upload():
    dsurl = 'http://datahub.io/api/data/ac5a28ea-eb52-4b0a-a399-5dcc1becf9d9'
    dsurl = 'http://localhost:9200/ds/rendition-on-record'
    client = datastore.client.DataStoreClient(dsurl)
    client.delete()
    client.upload(jsonout)