Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python elasticsearch put index

request_body = {
	    "settings" : {
	        "number_of_shards": 5,
	        "number_of_replicas": 1
	    },

	    'mappings': {
	        'examplecase': {
	            'properties': {
	                'address': {'index': 'not_analyzed', 'type': 'string'},
	                'date_of_birth': {'index': 'not_analyzed', 'format': 'dateOptionalTime', 'type': 'date'},
	                'some_PK': {'index': 'not_analyzed', 'type': 'string'},
	                'fave_colour': {'index': 'analyzed', 'type': 'string'},
	                'email_domain': {'index': 'not_analyzed', 'type': 'string'},
	            }}}
	}
	print("creating 'example_index' index..."
	es.indices.create(index = 'example_index', body = request_body)
Source by sarahleejane.github.io #
 
PREVIOUS NEXT
Tagged: #python #elasticsearch #put #index
ADD COMMENT
Topic
Name
6+6 =