To first verify that the desired index has been created in Elasticsearch as expected, execute the following from a command line:
curl –X GET 'http://localhost:9200/_cat/indices'
yellow open ondb.kvstore._checkpoint ...
yellow open ondb.kvstore.examplejsontable.jsontxtindex ...
Note that Elasticsearch reports the status of each index is yellow. This occurs here because the Elasticsearch cluster was deployed as a single-node cluster.
To examine the mapping that Oracle NoSQL constructs for Elasticsearch, execute:
curl –X GET 'http://localhost:9200/ondb.kvstore.examplejsontable.jsontxtindex/_mapping?pretty'
To display all documents from the exampleJsonTable
that were indexed in Elasticsearch, execute:
curl –X GET 'http://localhost:9200/ondb.kvstore.examplejsontable.jsontxtindex/_search?pretty'
Finally, to find all current democratic senators with contributions totaling between 5 million and 15 million dollars, who are members of either the "Progressive" caucus or the "Human Rights" caucus, execute the following command:
curl –X GET
'http://localhost:9200/ondb.kvstore.examplejsontable.jsontxtindex/_search?pretty'
'-d {query":{"bool":{
"must":{"match":{"jsonField.party":"Democrat"}},
"must":{"match":"jsonField.current":"true"}},
"must":{"range":{"jsonField.contrib":{"gte":"5000000.00","lte":15000000.00"}}},
"must":"match":{"jsonField.duties.caucus":"Progressive Human Rights"}}}}}'