Created
March 30, 2014 01:14
-
-
Save anonymous/9865739 to your computer and use it in GitHub Desktop.
Pasted from IPython
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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