inveniosoftware / inveniosoftware/domapping

How to use with ElasticSearch?

Open
#28 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14
Forks
8
PR merge metrics
No merged PRs in 30d

Description

I have been trying to use it with ElasticSearch this way:

```py
mapping = schema_to_mapping(json_schema, root_url, {}, ElasticMappingGeneratorConfig())
mappings = {indexname: mapping}
client = elasticsearch.Elasticsearch(hosts)
client.indices.create(index=indexname,
body={"mappings": mappings})
```
...but got the following error:

```
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Mapping definition for [_all] has unsupported parameters: [enable : true]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [kinto-bid-cid]: Mapping definition for [_all] has unsupported parameters: [enable : true]","caused_by":{"type":"mapper_parsing_exception","reason":"Mapping definition for [_all] has unsupported parameters: [enable : true]"}},"status":400}
```

I could get it to work by stripping out some part of the result of `schema_to_mapping`:

```python
mapping = schema_to_mapping(json_schema, root_url, {}, ElasticMappingGeneratorConfig())
mapping = {"properties": mapping["properties"]}
```

Am I doing something wrong? Is this expected?

Thanks for the tool :)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.