Skip to content

Instantly share code, notes, and snippets.

@arcolife
Forked from anonymous/file1.py
Created March 30, 2014 01:15
Show Gist options
  • Save arcolife/9865749 to your computer and use it in GitHub Desktop.
Save arcolife/9865749 to your computer and use it in GitHub Desktop.
f = open('_User.json','rb')
import json
data = json.loads(f.read())
f.close()
data
data[0]
data.keys()
data['results'][0]
data['results'][0].keys()
from pyes import *
conn = ES('localhost:9200')
conn.indices.create_index('takeZero')
conn.indices.create_index('take_zero')
data['results'][0].keys()
mapping = { u'username' : {'boost' : 1.0,
'index' : 'analyzed' ,
'store' : 'yes',
'type' : u'string',
"term_vector" : "with_positions_offsets"},
u'objectId' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'firstName' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'lastName' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'bcryptPassword' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'updatedAt' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'sessionToken' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'email' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'createdAt' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'summary' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'albums' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'headshot' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"}
u'profession' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
mapping = { u'username' : {'boost' : 1.0,
'index' : 'analyzed' ,
'store' : 'yes',
'type' : u'string',
"term_vector" : "with_positions_offsets"},
u'objectId' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'firstName' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'lastName' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'bcryptPassword' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'updatedAt' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'sessionToken' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'email' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'createdAt' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'summary' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'albums' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"},
u'headshot' : {'boost': 1.0,
'index': 'analyzed',
'store': 'yes',
'type': u'string',
"term_vector" : "with_positions_offsets"}
u'profession' : {'boost': 1.0,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment