The online JSON to ES Mapping tool quickly converts the Elasticsearch document structure into ES Mapping entity classes. Support field mapping, automatic type conversion, and code generation to improve development efficiency.
使用说明
feature introduction
- Support parsing nested json strings and parsing nested objects according to recursion
- Parsing array json string is supported. The first json string in the array will be parsed.
- Check whether the format of the json string is correct and the location of the output error
example
parsing nested json strings
{
"name": "test",
"age": 10,
"addr": "Sichuan Chengdu",
"cls_info": [
{
"name": "basketball class",
"teacher": "Mr. Zhang"
}
{
"name": "Art Class",
"teacher": "Miss Li"
}
]
}
After treatment
{
"mappings": {
"properties": {
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"age": {
"type": "integer"
},
"addr": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"cls_info": {
"properties": {
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"teacher": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
parsing array json strings directly
[
{
"name": "test",
"age": 10,
"addr": "Sichuan Chengdu",
"cls_info": [
{
"name": "basketball class",
"teacher": "Mr. Zhang"
}
{
"name": "Art Class",
"teacher": "Miss Li"
}
]
}
{
"name": "test2",
"age": 10,
"addr": "Sichuan Chengdu",
"cls_info": [
{
"name": "basketball class",
"teacher": "Mr. Zhang"
}
{
"name": "Art Class",
"teacher": "Miss Li"
}
]
}
]
After treatment
{
"mappings": {
"properties": {
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"age": {
"type": "integer"
},
"addr": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"cls_info": {
"properties": {
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"teacher": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}