Representing kinds in Search and querying across multiple kinds
Referring to: Search Service API-Specification
I would recommend storing the kind structure as a JSON object within the search engine, wildcard searches like "common:*:well:1.0.0"
or "common:*:*:*"
are rather inefficient compared to the breaking each component out into its own field like so:
{
"namespace": "common",
"source": "ihs",
"entityType": "well",
"version": {
"major": 1,
"minor": 0,
"build": 0,
}
}
Disclaimer: The above json snippit may not match the kind format used in the above example. It is used as illustrative purposes only.
The above example allows you to specify that you want to search the common
namespace by simply using a match query. This is the recommended best practice. Using the wildcard search Elasticsearch will be checking and matching every single document, almost a full scan of the inverted index. With a match query, it can leverage the inverted index standard usage pattern which is incredibly efficient compared to the alternative.
Furthermore, I would wonder if each of the text fields above would need to be the text data type... I feel they would be better suited to be keyword fields which lend themselves to the joys of lovely compression and smaller data requirements as they won't need to be analysed fields.