Querying From Console
In this section you will learn how to query Clusterpoint database from the management console.
1. Log into management console
2. Open database you want to query
As example we will use database "world_population" we have created previously and inserted data into it:
You can find file we have uploaded to database "world_population" here.
Before querying you need to define set of rules in database policy for document elements, or you can use default policy that is granted to database automatically when you create it. Learn more about policy rules in section "Indexing Policy".
3. Choose "Run Query" button
Choose "Run Query" button in actions toolbar and you will get into query editor:
Here you can execute Clusterpoint API commands against any of your databases.
Query composition area allows you to build queries with the help of auto-complete.
The default command is "Search", so we will try to query the database with geospatial search.
4. Enter query
You can enter query in command editor and press "Execute".
As example, we defined query to search for documents where <Country> value is "USA" and population <Density> in urban area is > 700:
<!-- inside <query> we define search criteria --> <query> <Country>USA</Country> <Density>> 700</Density> </query> <ordering><numeric><Population>descending</Population></numeric></ordering> <!-- Set numeric ordering by <Population> tag values --> <docs>20</docs> <!-- Number of documents in the result set you want to be displayed (default is 10) --> <offset>0</offset> <!-- Offset from the beginning of the result set (default is 0) --> <list> <document>yes</document> <!-- This part will be listed in the search results; <document> - is root tag, that means, that all tags will be listed --> </list>
You can find more about search query syntax in the next "Matching Documents" section.
You can find more about ordering in the following "Ordering Results" section.
Please take a note that query composed in the management console can be passed as a content to Search command through REST API.
5. Review results in the table
All matching results are listed below the query.
Our search request matches 4 documents, results are ordered by numeric values of <Population> tag:
You are able to inspect raw query, raw response, last executed queries by clicking corresponding buttons.
When you execute Aggregation, than you can see results in appropriate section "Aggregation results". For Aggregation you can also use "Analytics" section.
Notice, aggregate results represent results of aggregate operation and raw results you can see the text response instead of generated table.
Once you have results you want, you can copy query form the console into your code. If you are using REST API the request you composed in console is a valid content.
6. Commands available through UI console
You can Insert, Update, Retrieve or Lookup documents within command console in similar way as Search, but with the difference that document ID is required for these commands.
An example of Retrieve command (you should use document ID):