Add elasticsearch index
Jump to navigation
Jump to search
For a quick indexing of phpunit output results:
elasticsearch
Create an empty index:
curl -X PUT "localhost:9200/phpunit?pretty"
Insert a very first data set which defines all mappings or update the mapping with your own json definition:
curl -X POST -H "Content-Type: application/json" -d @phpunit_data.json http://127.0.0.1:9200/phpunit/result
or
curl -X PUT -H "Content-Type: application/json" -d @phpunit_mapping.json http://127.0.0.1:9200/phpunit/_mapping
example phpunit mapping file
{
"properties": {
"testsuite": {
"properties": {
"@attributes": {
"properties": {
"assertions": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"errors": {
"type": "integer"
},
"failures": {
"type": "integer"
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"skipped": {
"type": "integer"
},
"tests": {
"type": "integer"
},
"time": {
"type": "float"
},
"timestamp": {
"type": "date"
}
}
},
"testsuite": {
"properties": {
"@attributes": {
"properties": {
"assertions": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"errors": {
"type": "integer"
},
"failures": {
"type": "integer"
},
"file": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"skipped": {
"type": "integer"
},
"tests": {
"type": "integer"
},
"time": {
"type": "float"
}
}
},
"testcase": {
"properties": {
"@attributes": {
"properties": {
"assertions": {
"type": "integer"
},
"class": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"classname": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"file": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"line": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"time": {
"type": "float"
}
}
}
}
}
}
}
}
}
}
}