Native script for querying and filtering materialized paths
-
Run:
bin/plugin -install elasticsearch-script-path -url http://munkie.github.com/elasticsearch-script-path/downloads/elasticsearch-script-path-1.0.2.zip
. -
Add following line to elasticsearch.yml config file:
script.native:
pathFilter.type: org.elasticsearch.script.path.PathFilterFactory
pathQuery.type: org.elasticsearch.script.path.PathQueryFactory
Path Script | ElasticSearch |
---|---|
master | 0.90.7 -> master |
1.0.3 | 0.90.7 -> master |
1.0.2 | 0.20.1 |
1.0.1 | 0.19.11 |
1.0.0 | 0.19.11 |
curl -XGET http://localhost:9200/path/test/_search -d '{
"query": {
"custom_score": {
"query": {
"match_all": {}
},
"script": "pathQuery",
"params": {
"path": "1.2.3.5.6",
"field": "path"
},
"lang": "native"
}
}
}'
curl -XGET http://localhost:9200/path/test/_search -d '{
"query": {
"match_all": {}
},
"filter": {
"filter": {
"script": "pathFilter",
"lang": "native",
"params": {
"path": "1.2.3.5.6",
"field": "path"
"minLevel": 1,
"maxLevel": 4
}
}
}
}'
curl -XGET http://localhost:9200/path/test/_search -d '{
"query": {
"match_all": {}
},
"filter": {
"filter": {
"script": "pathFilter",
"lang": "native",
"params": {
"path": "1.2.3.5.6",
"field": "path",
"direct": true
}
}
}
}'