From the CLI
screenjson convert -i screenplay.fdx \
--db elasticsearch \
--db-host http://es:9200 \
--db-collection screenplays
Recommended mapping
PUT /screenplays
{
"mappings": {
"properties": {
"id": { "type": "keyword" },
"version": { "type": "keyword" },
"title": {
"properties": {
"en": { "type": "text" },
"fr": { "type": "text" }
}
},
"logline": {
"properties": {
"en": { "type": "text" }
}
},
"genre": { "type": "keyword" },
"themes": { "type": "keyword" },
"characters": {
"type": "nested",
"properties": {
"id": { "type": "keyword" },
"name": { "type": "keyword" },
"traits": { "type": "keyword" }
}
},
"document": {
"properties": {
"scenes": {
"type": "nested",
"properties": {
"heading.context": { "type": "keyword" },
"heading.setting": { "type": "keyword" },
"heading.time": { "type": "keyword" },
"locations": { "type": "keyword" },
"props": { "type": "keyword" }
}
}
}
}
}
}
}
Faceted search query
Night exteriors in horror scripts, aggregated by location:
POST /screenplays/_search
{
"query": {
"bool": {
"filter": [
{ "term": { "genre": "horror" } },
{
"nested": {
"path": "document.scenes",
"query": {
"bool": {
"filter": [
{ "term": { "document.scenes.heading.context": "EXT" } },
{ "term": { "document.scenes.heading.time": "NIGHT" } }
]
}
}
}
}
]
}
},
"aggs": {
"locations": {
"nested": { "path": "document.scenes" },
"aggs": { "by_location": { "terms": { "field": "document.scenes.heading.setting" } } }
}
}
}