Home > Blockchain >  Getting mapper_parsing_exception in OpenSearch
Getting mapper_parsing_exception in OpenSearch

Time:03-31

I'm new to OpenSearch, and I'm following the indexing pattern mentioned here for a POC.

I'm trying to test the mapping mentioned here : https://github.com/spryker/search/blob/master/src/Spryker/Shared/Search/IndexMap/search.json in OpenSearch dev console.


PUT testindex
{
    "settings": {
        "index": {
            "number_of_shards": 1,
            "number_of_replicas": 1
        },
        "analysis": {
            "analyzer": {
                "lowercase_keyword_analyzer": {
                    "tokenizer": "keyword",
                    "filter": ["lowercase"]
                },
                "suggestion_analyzer": {
                    "tokenizer": "standard",
                    "filter": ["lowercase"]
                }
            },
            "normalizer": {
                "lowercase_normalizer": {
                    "type": "custom",
                    "char_filter": [],
                    "filter": ["lowercase"]
                }
            }
        }
    },
    "mappings": {
        "page": {
            "dynamic_templates": [
                {
                    "search-result-data": {
                        "mapping": {
                            "index": "false"
                        },
                        "path_match": "search-result-data.*"
                    }
                },
                {
                    "string_sort": {
                        "mapping": {
                            "analyzer": "lowercase_keyword_analyzer",
                            "type": "keyword"
                        },
                        "path_match": "string-sort.*"
                    }
                },
                {
                    "integer_sort": {
                        "mapping": {
                            "type": "integer"
                        },
                        "path_match": "integer-sort.*"
                    }
                }
            ],
            "properties": {
                "search-result-data": {
                    "type": "object",
                    "include_in_all": false,
                    "properties": {}
                },
                "type": {
                    "type": "keyword",
                    "include_in_all": false
                },
                "store": {
                    "type": "keyword",
                    "include_in_all": false
                },
                "is-active": {
                    "type": "boolean",
                    "include_in_all": false
                },
                "active-from": {
                    "type": "date",
                    "include_in_all": false
                },
                "active-to": {
                    "type": "date",
                    "include_in_all": false
                },
                "locale": {
                    "type": "keyword",
                    "include_in_all": false
                },
                "full-text": {
                    "type": "text",
                    "include_in_all": false
                },
                "full-text-boosted": {
                    "type": "text",
                    "include_in_all": false
                },
                "string-facet": {
                    "type": "nested",
                    "include_in_all": false,
                    "properties": {
                        "facet-name": {
                            "type": "keyword"
                        },
                        "facet-value": {
                            "type": "keyword"
                        }
                    }
                },
                "integer-facet": {
                    "type": "nested",
                    "include_in_all": false,
                    "properties": {
                        "facet-name": {
                            "type": "keyword"
                        },
                        "facet-value": {
                            "type": "integer"
                        }
                    }
                },
                "completion-terms": {
                    "type": "keyword",
                    "include_in_all": false,
                    "normalizer": "lowercase_normalizer"
                },
                "suggestion-terms": {
                    "type": "text",
                    "include_in_all": false,
                    "analyzer": "suggestion_analyzer"
                },
                "string-sort": {
                    "type": "object",
                    "include_in_all": false,
                    "properties": {}
                },
                "integer-sort": {
                    "type": "object",
                    "include_in_all": false,
                    "properties": {}
                },
                "category": {
                    "type": "object",
                    "include_in_all": false,
                    "properties": {
                        "direct-parents": {
                            "type": "integer"
                        },
                        "all-parents": {
                            "type": "integer"
                        }
                    }
                }
            }
        }
    }
}

I'm getting the error :


"type" : "mapper_parsing_exception",
"reason" : "Root mapping definition has unsupported parameters:  [page : {dynamic_templates=[{search-result-data={path_match=search-result-data.*, mapping={index=false}}}, {string_sort={path_match=string-sort.*, mapping={analyzer=lowercase_keyword_analyzer, type=keyword}}}, {integer_sort={path_match=integer-sort.*, mapping={type=integer}}}], properties={integer-facet={include_in_all=false, type=nested, properties={facet-value={type=integer}, facet-name={type=keyword}}}, full-text={include_in_all=false, type=text}, integer-sort={include_in_all=false, type=object, properties={}}, search-result-data={include_in_all=false, type=object, properties={}}, string-sort={include_in_all=false, type=object, properties={}}, suggestion-terms={include_in_all=false, analyzer=suggestion_analyzer, type=text}, completion-terms={include_in_all=false, normalizer=lowercase_normalizer, type=keyword}, is-active={include_in_all=false, type=boolean}, store={include_in_all=false, type=keyword}, type={include_in_all=false, type=keyword}, locale={include_in_all=false, type=keyword}, active-to={include_in_all=false, type=date}, string-facet={include_in_all=false, type=nested, properties={facet-value={type=keyword}, facet-name={type=keyword}}}, category={include_in_all=false, type=object, properties={all-parents={type=integer}, direct-parents={type=integer}}}, active-from={include_in_all=false, type=date}, full-text-boosted={include_in_all=false, type=text}}}]"

Which is unhelpful. Can anyone help me identify the actual error?

Thanks

CodePudding user response:

You need to replace page by _doc (or remove it altogether) as there's no more mapping types

"mappings": {
    "_doc": {
        "dynamic_templates": [
  • Related