현재 Elasticsearch에 대한 매핑 파일을 단순화하기 위해 고심하고 있습니다. 실제로 동일한 구조의 여러 Object
필드가 있습니다 (예 : 여기에서 소스와 대상)여러 정확한 필드와 일치하는 동적 검색 동적 템플릿
여러 패턴과 일치 할 수 있도록 동적 템플릿을 설정하는 방법이 있습니까?
는 여기에 내가 실행 무엇 : 나는 (~ 20)에 맞도록이 같은 계획을 많이 가지고
POST /_template/mapping-lol
{
"template": "*-newevents-*",
"mappings": {
"log": {
"dynamic_templates": [
{
"system": {
"match_pattern": "regex",
"match": "^(source|destination)$",
"mapping": {
"properties": {
"name": {
"dynamic": false,
"type": "object",
"properties": {
"first": {
"type": "text"
},
"last": {
"type": "text"
}
}
},
"ip": {
"type": "ip"
}
}
}
}
}
],
"properties": {
"source": {
"type": "object",
"dynamic": true
},
"destination": {
"type": "object",
"dynamic": true
}
}
}
}
}
POST /tenant-newevents-1/log
{
"source": {
"name": {
"first": "John",
"last": "Doe"
},
"ip": "1.2.3.4"
},
"destination": {
"name": {
"first": "Jane",
"last": "Doe"
},
"ip": "3.4.5.6"
}
}
GET /tenant-newevents-1
이 위에서 작동하지 않습니다 ...
.
도움 주셔서 감사합니다.
나에게 잘 어울립니다. ES 5와 6을 시험해 보았는데 제대로 작동했습니다. 색인/매핑을 만드는 방법을 보여주십시오. – Val
curl -XPOST "locallhost : 9200/_template/mapping-events"[email protected] – moutonjr
좋습니다! mymapping.json의 내용은 어떻습니까? – Val