{
    "mappings": {
        "user": {
            "properties": {
                "friends": {
                    "properties": {
                        "friend_id": {
                            "type": "string"
                        },
                        "friend_status": {
                            "type": "string"
                        }
                    }
                },
                "fullname": {
                    "type": "string",
                    "fields": {
                        "searchable": {
                            "type": "string",
                            "analyzer": "username_index",
                            "search_analyzer": "username_search"
                        }
                    },
                    "analyzer": "username_search"
                },
                "id": {
                    "type": "string"
                },
                "user_id": {
                    "type": "string"
                },
                "username": {
                    "type": "string",
                    "fields": {
                        "raw": {
                            "type": "string",
                            "analyzer": "case_insensitive_sort"
                        },
                        "searchable": {
                            "type": "string",
                            "analyzer": "username_index",
                            "search_analyzer": "username_search"
                        }
                    },
                    "analyzer": "username_search"
                }
            }
        }
    },
    "settings": {
        "index": {
            "analysis": {
                "filter": {
                    "username_ngram": {
                        "type": "edgeNGram",
                        "min_gram": "3",
                        "max_gram": "15"
                    }
                },
                "analyzer": {
                    "username_index": {
                        "filter": [
                            "standard",
                            "lowercase",
                            "asciifolding",
                            "username_ngram"
                        ],
                        "type": "custom",
                        "tokenizer": "standard"
                    },
                    "case_insensitive_sort": {
                        "filter": [
                            "lowercase"
                        ],
                        "type": "custom",
                        "tokenizer": "keyword"
                    },
                    "username_search": {
                        "filter": [
                            "standard",
                            "lowercase",
                            "asciifolding"
                        ],
                        "type": "custom",
                        "tokenizer": "standard"
                    }
                }
            }
        }
    }
}
