Skip to content

Instantly share code, notes, and snippets.

@icedfish
Last active August 29, 2015 14:01
Show Gist options
  • Save icedfish/05717faa009d4742ccfa to your computer and use it in GitHub Desktop.
Save icedfish/05717faa009d4742ccfa to your computer and use it in GitHub Desktop.
curl -X PUT localhost:9200/index_name -d @es_meta.json
{
"index": {
"analysis": {
"analyzer": {
"pinyin_analyzer": {
"tokenizer": "my_pinyin",
"filter": [
"standard",
"nGram"
]
}
},
"tokenizer": {
"my_pinyin": {
"type": "pinyin",
"first_letter": "append",
"padding_char": " "
}
}
}
},
"settings": {
"index.cache.field.type": "soft",
"index": {
"refresh_interval": "5s",
"number_of_shards": 10,
"number_of_replicas": 0,
"date_detection": false,
"numeric_detection": true,
"query": {
"default_field": "uri"
},
"store": {
"compress": {
"stored": true,
"tv": true
}
}
}
},
"mappings": {
"_default_": {
"date_detection": false,
"numeric_detection": true,
"store": "no",
"_id": {
"path": "id"
},
"_type": {
"enabled": true
},
"_timestamp": {
"enabled": true,
"store": "no"
},
"_source": {
"enabled": true,
"compress": true
},
"_all": {
"enabled": false
},
"_routing": {
"path": "_routing_",
"required": true
},
"dynamic_templates": [
{
"template_tags": {
"match": "*s",
"match_mapping_type": "string",
"mapping": {
"analyzer": "tags"
}
}
},
{
"template_string": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"index": "not_analyzed",
"type": "string"
}
}
},
{
"template_long": {
"match": "*",
"match_mapping_type": "long",
"mapping": {
"ignore_malformed": true
}
}
},
{
"template_float": {
"match": "*",
"match_mapping_type": "float",
"mapping": {
"ignore_malformed": true
}
}
},
{
"template_double": {
"match": "*",
"match_mapping_type": "double",
"mapping": {
"ignore_malformed": true
}
}
}
],
"properties": {
"name": {
"type": "string",
"store": "yes"
},
"title": {
"type": "string",
"index": "analyzed",
"analyzer": "ik"
},
"position": {
"type": "geo_shape"
},
"suggest_field": {
"context": {
"city": {
"type": "category",
"path": "city",
"default": "shanghai"
}
},
"type": "completion",
"index_analyzer": "simple",
"search_analyzer": "simple",
"max_input_length": 100,
"payloads": true
}
}
}
}
}
@icedfish
Copy link
Author

suggest_field should be used after ES v1.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment