Skip to content

Commit

Permalink
#3: Try testing mapper-size plugin on ES.
Browse files Browse the repository at this point in the history
  • Loading branch information
reynoldsalec committed Nov 1, 2021
1 parent 3fa2cc3 commit ad82d30
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 0 additions & 1 deletion examples/elasticsearch-6.5/.platform.app.yaml
Expand Up @@ -8,5 +8,4 @@ web:
root: "."
passthru: "/index.php"
relationships:
elasticsearch: "searchelastic:elasticsearch"
elasticsearch-plugin: "searchelastic-plugin:elasticsearch"
2 changes: 0 additions & 2 deletions examples/elasticsearch-6.5/.platform/services.yaml
@@ -1,5 +1,3 @@
searchelastic:
type: elasticsearch:6.5
searchelastic-plugin:
type: elasticsearch:6.5
configuration:
Expand Down
10 changes: 10 additions & 0 deletions examples/elasticsearch-6.5/README.md
Expand Up @@ -48,6 +48,16 @@ lando ssh -s app -c "curl localhost/esearch.php" | grep "Barbara Liskov"

# Should be running the correct elasticsearch versions (plugin service)
lando ssh -s searchelastic-plugin -c "curl -XGET 'http://localhost:9200'" | grep 6.5

# Should be able to enable the _size field for mapper-size plugin
lando ssh -s searchelastic-plugin -c "curl -X PUT 'localhost:9200/my_index?pretty' -H 'Content-Type:application/json' -d'{\"mappings\": {\"_doc\": {\"_size\": {\"enabled\": true}}}}'"

# Should be able to add a doc to the ES index
lando ssh -s searchelastic-plugin -c "curl -X PUT 'localhost:9200/my-index/_doc/1?pretty' -H 'Content-Type: application/json' -d'{\"text\": \"This is a document\"}'"

# Should see _size field when querying ES index.
lando ssh -s searchelastic-plugin -c "curl -X GET 'localhost:9200/my_index/_search?pretty' -H 'Content-Type: application/json' -d '{ \"query\": { \"range\": { \"_size\": { \"gt\": 10 } } }, \"aggs\": { \"sizes\": { \"terms\": { \"field\": \"_size\", \"size\": 10 } } }, \"sort\": [ { \"_size\": { \"order\": \"desc\" } } ], \"script_fields\": { \"size\": { \"script\": \"doc[\\u0027_size\\u0027]\" } }}'"

```

Destroy tests
Expand Down

0 comments on commit ad82d30

Please sign in to comment.