{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Table of contents","description":"Accelerate E&P application development and protect your innovation by consuming our Data and Domain APIs / Platform APIs.","lang":"en-US","meta":[{"name":"robots","content":"noindex"}],"llmstxt":{"hide":true,"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"table-of-contents","__idx":0},"children":["Table of contents ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"TOC"},"children":[]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#introduction"},"children":["Introduction"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#search-api-access"},"children":["Search API access"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#permissions"},"children":["Permissions"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#normalization"},"children":["Normalization"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#query"},"children":["Query API"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#query-by-kind"},"children":["Query by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#additional-kind-attributes"},"children":["Additional ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," attributes"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#kind-case-sensitivity"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," case sensitivity"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#text-queries"},"children":["Text queries"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#examples"},"children":["Examples"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#text-field-indexing"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field indexing"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#exact-match"},"children":["Exact match"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#query-null-values"},"children":["Query ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["empty"]}," values"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#exists-query"},"children":["Exists query"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#reserved-characters"},"children":["Reserved characters"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#wildcards"},"children":["Wildcards"]}]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#grouping"},"children":["Grouping"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#date-format"},"children":["Date Format"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#nested-queries"},"children":["Query ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," arrays objects"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#aggregate-queries"},"children":["Aggregation"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#nested-aggregation"},"children":["Aggregation by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," arrays objects"]}]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#sort-queries"},"children":["Sort"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#text-field-sort"},"children":["Sort on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#nested-text-field-sort"},"children":["Sort on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields"]}]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#range-queries"},"children":["Range queries"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#geo-spatial-queries"},"children":["Geo-spatial queries"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#geo-distance"},"children":["Geo distance"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#distance-units"},"children":["Distance units"]}]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#bounding-box"},"children":["Bounding box"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#geo-polygon"},"children":["Geo polygon"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#geo-polygon-intersection"},"children":["Geo polygon intersection query"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#query-with-cursor"},"children":["Query with cursor API"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#cross-kind-queries"},"children":["Cross ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," queries"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#common-discovery-within-and-across-kind"},"children":["Common discovery within and across ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," via ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["VirtualProperties"]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#version-info"},"children":["Version info API"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#get-indexing-status"},"children":["Get indexing status"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#known-limitations"},"children":["Known issues/limitations"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"introduction","__idx":1},"children":["Introduction ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"introduction"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Search API provides a mechanism for indexing documents that contain structured data. You can search an index and organize and present search results. Documents and indexes are saved in a separate persistent store optimized for search operations. The Search API can index any number of documents."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The API supports full-text search on string fields, range queries on dates, numeric or string fields, etc., along with geo-spatial search."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"search-api-access","__idx":2},"children":["Search API access ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"search-api-access"},"children":[]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Required roles"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Search service requires that users have dedicated roles in order to use it. Users must be a member of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["users.datalake.viewers"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["users.datalake.editors"]},", or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["users.datalake.admins"]},". Roles can be assigned using the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://community.opengroup.org/osdu/platform/security-and-compliance/entitlements"},"children":["Entitlements service"]},". Please look at the API documentation for specific requirements."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In addition to service roles, users ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["must"]}," be a member of data groups to access the data."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Required headers"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Managed Planning Data Foundation stores data in different partitions, depending on the different accounts in the OSDU system."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A user may belong to more than one account.  As a user, after logging into the OSDU portal, you must select the account you wish to be active."," ","Likewise, when using the Search APIs, you must specify the active account in the header called ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Data-Partition-Id"]},". The correct ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Data-Partition-Id"]}," can be obtained from the CFS services. The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Data-Partition-Id"]}," enables the search within the mapped partition."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"Data-Partition-Id: opendes\n"},"children":[]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Optional headers"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Correlation-Id is a traceable ID to track the journey of a single request. The Correlation-Id can be a GUID in the header with a key. It is a best practice to provide the Correlation-Id so that the request can be tracked through all the services."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"Correlation-Id: 1e0fef08-22fd-49b1-a5cc-dffa21bc0b70\n"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If the service is initiating the request, an ID should be generated. If the Correlation-Id is not provided, then a new ID will be generated by the service so that the request will be traceable."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"permissions","__idx":3},"children":["Permissions ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"permissions"},"children":[]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Endpoint URL"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Method"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Minimum permissions required"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Data permissions required"]}]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["/search/v2/query"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["POST"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["users.datalake.viewers"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["/search/v2/query_with_cursor"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["POST"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["users.datalake.viewers"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"normalization","__idx":4},"children":["Normalization ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"normalization"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Retrieved data from the Managed Planning Data Foundation is normalized to a common standard that allows for comparison from multiple data sources. We currently support conversion for only Unit, CRS, and DateTime, whose common standards are in SI, WGS84, and UTC respectively."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For any attribute that has a ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://community.opengroup.org/osdu/data/data-definitions/-/blob/master/Authoring/abstract/AbstractSpatialLocation.1.0.0.json"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AbstractSpatialLocation"]}]}," schema reference, the coordinates can have attribute named ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AsIngestedCoordinates"]}," using an ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://community.opengroup.org/osdu/data/data-definitions/-/blob/master/Generated/abstract/AbstractAnyCrsFeatureCollection.1.0.0.json"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AbstractAnyCrsFeatureCollection"]}]}," schema reference or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WGS84Coordinates"]}," attribute using an ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://community.opengroup.org/osdu/data/data-definitions/-/blob/master/Generated/abstract/AbstractFeatureCollection.1.0.0.json"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AbstractFeatureCollection"]}]}," schema reference. However, The search cannot use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AsIngestedCoordinates"]}," in a meaningful way, so it does not index the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AsIngestedCoordinates"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Indexer service uses Storage service's frame of reference conversion API (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/records:batch"]}," API) for conversion. If the Storage API returns with a valid converted ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WGS84Coordinates"]}," for the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AsIngestedCoordinates"]},", then the converted coordinates will be indexed. If the conversion fails, then the Indexer will not index the shape in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WGS84Coordinates"]}," attribute. Indexer service will index conversion error for the record with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["400"]}," error code instead. Please refer to ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#get-indexing-status"},"children":["Get indexing status"]}," for details on index status. Only the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WGS84Coordinates"]}," are returned in the search response."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"how-conversion-is-handled-for-asingestedcoordinates-and-wgs84coordinates-","__idx":5},"children":["How conversion is handled for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AsIngestedCoordinates"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WGS84Coordinates"]},":"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WGS84Coordinates"]}," block is provided in the record, then we take the values from the block. The Storage ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/records:batch"]}," API does no conversion."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If only the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AsIngestedCoordinates"]}," block is provided in the record, then the Storage ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/records:batch"]}," API performs the conversion for the coordinates provided. If the conversion fails, then indexing of the attribute is skipped, instead error message is indexed. You can query the Indexing status using ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#get-indexing-status"},"children":["Get indexing status"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If BOTH the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AsIngestedCoordinates"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WGS84Coordinates"]}," blocks are provided in the record, then the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AsIngestedCoordinates"]}," block is ignored, and it takes the values from the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["WGS84Coordinates"]}," block. The Storage ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/records:batch"]}," API does no conversion."]}]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["NOTE"]},": If a storage record has correct frame of reference conversion information (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["meta"]}," block), then records are ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["always"]}," normalized and indexed according to common standard mentioned above. Users can only perform queries on Search service on standardized indexed records."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"query","__idx":6},"children":["Query ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"query"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Managed Planning Data Foundation search provides a JSON-style domain-specific language that you can use to execute queries. The Query request URL and example follow:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": \"osdu:wks:master-data--Well:1.0.0\",\n  \"query\": \"data.FacilityName:\\\"A34\\\"\",\n  \"offset\": 0,\n  \"limit\": 30,\n  \"sort\": {\n    \"field\": [\"id\"],\n    \"order\": [\"ASC\"]\n  },\n  \"queryAsOwner\": false,\n  \"spatialFilter\": {\n    \"field\": \"data.SpatialLocation.Wgs84Coordinates\",\n    \"byBoundingBox\": {\n      \"topLeft\": {\n        \"latitude\": 90,\n        \"longitude\": -180\n      },\n      \"bottomRight\": {\n        \"latitude\": -90,\n        \"longitude\": 180\n      }\n    }\n  },\n  \"trackTotalCount\": true,\n  \"returnedFields\": [ \"kind\", \"id\", \"data.FacilityName\", \"data.SpatialLocation.Wgs84Coordinates\", \"data.TechnicalAssuranceID\" ]\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"osdu:wks:master-data--Well:1.0.0\",\n  \"query\": \"data.FacilityName:\\\"A34\\\"\",\n  \"offset\": 0,\n  \"limit\": 30,\n  \"sort\": {\n    \"field\": [\"id\"],\n    \"order\": [\"ASC\"]\n  },\n  \"queryAsOwner\": false,\n  \"spatialFilter\": {\n    \"field\": \"data.SpatialLocation.Wgs84Coordinates\",\n    \"byBoundingBox\": {\n      \"topLeft\": {\n        \"latitude\": 90,\n        \"longitude\": -180\n      },\n      \"bottomRight\": {\n        \"latitude\": -90,\n        \"longitude\": 180\n      }\n    }\n  },\n  \"trackTotalCount\": true,\n   \"returnedFields\": [ \"kind\", \"id\", \"data.FacilityName\", \"data.SpatialLocation.Wgs84Coordinates\", \"data.TechnicalAssuranceID\" ]\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example response:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"results\": [\n    {\n      \"data\": {\n        \"SpatialLocation.Wgs84Coordinates\": {\n          \"geometries\": [\n            {\n              \"coordinates\": [\n                173.2900972,\n                -39.4324222\n              ],\n              \"type\": \"point\"\n            }\n          ],\n          \"type\": \"geometrycollection\"\n        },\n        \"TechnicalAssuranceID\": \"opendes:reference-data--TechnicalAssuranceType:Suitable:\",\n        \"FacilityName\": \"A34\"\n      },\n      \"kind\": \"osdu:wks:master-data--Well:1.0.0\",\n      \"id\": \"opendes:master-data--Well:ca3271c789964d54a1c4d873d2c1aef1\"\n    }\n    ....\n  ],\n  \"totalCount\": 4644\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," : Once the records have been successfully ingested by the Storage service, it can take ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["at least 30 seconds"]}," to become searchable via Search service in the Managed Planning Data Foundation. Record level indexing status can be retrieved via ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#get-indexing-status"},"children":["index status"]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"parameters","__idx":7},"children":["Parameters ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"parameters"},"children":[]}]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["kind"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The kind of records to query. kind is unique identifier (or a tag) given to the schema. Kind is case-insensitive. For details about the schema, refer to ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://community.opengroup.org/osdu/platform/system/schema-service"},"children":["Schema Service"]},". In the query, kind is a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["required"]}," field, and its value can be a single schema identity or a list of schema identities, such as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"osdu:wks:master-data--Well:1.0.0\""]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[\"osdu:wks:master-data--Well:1.0.0\", \"osdu:wks:master-data--Wellbore:1.0.0\"]"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["query"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The Query string is based on Lucene query string syntax, supplemented with a specific format for describing queries to fields of object arrays indexed with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," hint. The maximum number of clauses on a query can be ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["1024"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["offset"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The starting offset from which to return results."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["limit"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The maximum number of results to return from the given offset. If no limit is provided, then it returns ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["10"]}," items. The minimum & maximum number of items that the query can fetch are ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["1"]}," & ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["1000"]}," respectively. (If you wish to fetch a larger set of items, use the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#query-with-cursor"},"children":["query_with_cursor"]}," API)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["sort"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Allows you to add one or more sorts on specific fields. The length of fields and the length of order must match. The order value must be either ASC or DESC (case insensitive). For more details and limitations about this feature, refer to ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#sort-queries"},"children":["Sort"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["queryAsOwner"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["If true, the result only contains the records that the user owns. If false, the result contains all records that the user is entitled to see. The default value is false."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["spatialFilter"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["A spatial filter to apply. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#geo-spatial-queries"},"children":["Geo-spatial queries"]}," for details."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["trackTotalCount"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Tracks the accurate record count matching the query if 'true'; otherwise it is a partial count. Partial count queries are more performant. The default is 'false' and returns 10000 if matching records are higher than 10000."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["aggregateBy"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Allows you to get a unique value of a given field, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#aggregate-queries"},"children":["Aggregate Queries"]}," for details."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["returnedFields"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Specifies the fields on which to project the results."]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Important:"]}," Field names in request parameters are case-sensitive. Field values are case-insensitive, unless you are querying for  an ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#exact-match"},"children":["exact match"]}," with a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["keyword"]}," subfield for the attribute."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," The Offset + Limit can not be more than 10,000. See the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#query-with-cursor"},"children":["Query with cursor"]}," topic for more efficient ways to do deep scrolling."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"query-by-kind","__idx":8},"children":["Query by kind ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"query-by-kind"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," can be formatted as authority/data-partition-id:data-source-id:entity-type:schema-version and a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["required"]}," field. You can retrieve the available list of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," by using the Storage service(GET /query/kinds API). Users can make search documents by providing ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," as shown:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Search documents just by providing a single ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]},":"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.0.0\"\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.0.0\"\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Search documents just by providing a multi-kinds:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": [\"osdu:wks:master-data--Well:1.0.0\",\"osdu:wks:master-data--Wellbore:1.0.0\"]\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": [\"osdu:wks:master-data--Well:1.0.0\",\"osdu:wks:master-data--Wellbore:1.0.0\"]\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The query returns up to 10 (default limit) documents for the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Wildcard queries on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," are also supported, refer to ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#cross-kind-queries"},"children":["Cross ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," queries"]}," for more information."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"additional-kind-attributes","__idx":9},"children":["Additional ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," attributes ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"additional-kind-attributes"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Managed Planning Data Foundation indexer splits ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," value and add few new fields (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["authority"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["source"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["namespace"]}," & ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["type"]},") on indexed record. These terms can then be queried with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["query"]}," request parameter."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For example ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["osdu:wks:master-data--Wellbore:1.0.0"]}," will add following new indexed attribute:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  ...\n  ...\n  \"authority\": \"osdu\",\n  \"source\": \"wks\",\n  \"namespace\": \"osdu:wks\",\n  \"type\": \"master-data--Wellbore\"\n  ...\n  ...\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Managed Planning Data Foundation can be now queried to search based on one of these attributes."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"kind-case-sensitivity","__idx":10},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," case sensitivity ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"kind-case-sensitivity"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Search does not differentiate ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," request parameter case sensitivity while querying records across kinds differing in case."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["e.g. if there are 2 records of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["osdu:wks:USER:1.1.0"]}," and 2 records of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["osdu:wks:user:1.1.0"]},". Following query will return 4 records, since Search service considers these 2 kinds to be the same:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": [\"osdu:wks:user:1.1.0\"]\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"text-queries","__idx":11},"children":["Text queries ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"text-queries"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Managed Planning Data Foundation provides comprehensive query options in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://lucene.apache.org/core/2_9_4/queryparsersyntax.html"},"children":["Lucene query syntax"]},". The query string is parsed into a series of terms and operators. A term can be a single word, such as \"producing\" or \"well\", or a phrase, surrounded by double quotes, such as \"producing well\", which searches for all the words in the phrase, in the same order. The default operator for the query is ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["OR"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can search a field in the document ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<field-name>:<value>"]},". If field is not defined, then it defaults to all queryable fields, and the query will automatically attempt to determine the existing fields in the index’s mapping that are queryable, and perform the search on those fields."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The query language is quite comprehensive and can be intimidating at first glance, but the best way to actually learn it is to start with a few basic examples."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}]}," is a required parameter and is omitted for brevity in following examples. Also, all storage record properties are in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," block. Any reference to a field inside the block should be prefixed with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"examples","__idx":12},"children":["Examples ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"examples"},"children":[]}]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Search all fields that contain the text 'well':"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"well\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," If ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<field-name>"]}," is not specified, the query string will automatically attempt to determine the existing fields in the index’s mapping that are queryable, and perform the search on those fields. The search query will be ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["more performant"]}," if field names are specified in the query instead of searching across all queryable attributes. The following examples cover this:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Where the Basin field contains \"Permian\":"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"data.Basin:Permian\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Where the Rig_Contractor field contains \"Ocean\" or \"Drilling\". OR is the default operator:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"data.Rig_Contractor:(Ocean OR Drilling)\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["or"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"data.Rig_Contractor:(Ocean Drilling)\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Where the Rig_Contractor field contains the exact ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["phrase"]}," \"Ocean Drilling\":"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"data.Rig_Contractor:\\\"Ocean Drilling\\\"\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Search service offers additional query patterns to query ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["precise"]}," values. For details see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#exact-match"},"children":["exact match"]},"."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Where any of the fields ValueList.OriginalValue, ValueList.Value, or ValueList.AppDataType contains \"PRODUCING\" or \"DUAINE\". (Note that you need to escape the * with a backslash.)"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"data.ValueList.\\\\*:(PRODUCING DUAINE)\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"text-field-indexing","__idx":13},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field indexing ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"text-field-indexing"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["By default, search back-end server analyzes the values of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields & ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," array fields (including ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x-osdu-indexing"]}," hints) during indexing. The Indexer service analyzer changes text field values as follows:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Removes most punctuation & prepositions."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Divides the remaining content into individual words, called tokens."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Changes the tokens to lowercase."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To better support a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["precise"]}," exact match, aggregation & sort on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field, an additional field is indexed (on kinds indexed after April 2021) for every ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field, that is not analyzed (as per rules mentioned above). As an example, if record has a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field named ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.name"]},", then the indexer will add the non-analyzed field: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.name.keyword"]},". Newly added ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields can be identified as: field-name.",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["keyword"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note 1:"]}," The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["keyword"]}," field value can have a maximum of 256 characters, and only exact match is supported for this field, so a partial field value query will not return any response. If a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field is longer than 256 characters, then the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["keyword"]}," field will have only the first 256 characters."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note 2"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," array fields indexed with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["flattened"]}," indexing hint are non-analyzed during indexing by default and do not require ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["keyword"]}," subfield. Exact match, aggregations and sort queries on such fields do not require ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["keyword"]}," suffix."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"exact-match","__idx":14},"children":["Exact match ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"exact-match"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the exact match query to search records based on a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["precise"]}," value using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["keyword"]}," subfield mentioned ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#text-field-indexing"},"children":["here"]},", such as well ID, name, etc. on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["As indexed ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["keyword"]}," subfield is not analyzed, query on this field is ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["case sensitive"]}," & ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["no escaping"]}," is required for special characters covered in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#reserved-characters"},"children":["reserved characters"]}," section."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here is an example query, it two special characters, space and period, without any escaping:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"query\": \"data.name.keyword:\\\"Spillpath DA no.109\\\"\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"query-null-or-empty-values","__idx":15},"children":["Query ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," or empty values ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"query-null-values"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["keyword"]}," subfield can also be utilized to query records by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," or empty value on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," attributes. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," value search/index workflows are only supported on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here is a sample query to search ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," value:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n   \"kind\": \"osdu:wks:master-data--Well:1.0.0\",\n   \"query\": \"data.FacilityID.keyword:null\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here is an example query to search ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["empty"]}," value:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n   \"kind\": \"osdu:wks:master-data--Well:1.0.0\",\n   \"query\": \"data.FacilityID.keyword:\\\"\\\"\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"exists-query","__idx":16},"children":["Exists query ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"exists-query"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Returns documents that contain an indexed value for a field. Use the _exists_ prefix for a field to search to see if the field exists."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["While a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field is deemed non-existent if the JSON value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]},", following values will indicate the field does exist:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Empty strings, such as \"\"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["keyword"]}," subfield with explicit ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," value."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Similarly ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text array"]}," field considered non-existent if the JSON value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[]"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text arrays"]}," containing ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]}," and another value , such as [",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["null"]},", \"abc\"] indicates the field does exist."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example request:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Where query returns if the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field Status has any non-null value."]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"_exists_:data.Status\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"reserved-characters","__idx":17},"children":["Reserved characters ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"reserved-characters"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you need to use any of the characters which function as operators in your query itself (and not as operators), then you must escape them with a leading backslash. For example, to search for (1+1)=2, you would need to write your query as \\(1\\+1\\)\\=2."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The reserved characters are: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["+ - = && || > < ! ( ) { } [ ] ^ \" ~ * ? : \\ /"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Failing to escape these special characters correctly could lead to a syntax error which prevents your query from running."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," < and > can’t be escaped at all. The only way to prevent them from attempting to create a ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#range-queries"},"children":["range query"]}," is to remove them from the query string entirely."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"wildcards","__idx":18},"children":["Wildcards ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"wildcards"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Wildcard searches can be run on individual terms using ? to replace a single character and * to replace zero or more characters."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"data.Rig_Contractor:Oc?an Dr*\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Be aware that wildcard queries can use an enormous amount of memory and therefore can effect the performance.  They should be used very sparingly."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," Leading wildcards are disabled by the Managed Planning Data Foundation Search service. Allowing a wildcard at the beginning of a word, such as \"*ean\", is particularly heavy because all the terms in the index need to be examined, just in case they match."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"grouping","__idx":19},"children":["Grouping ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"grouping"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Multiple terms or clauses can be grouped together with parentheses to form sub-queries."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"data.Rig_Contractor:(Ocean OR Drilling) AND Exploration NOT Basin\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"date-format","__idx":20},"children":["Date Format ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"date-format"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you need to use the date in your query, it must be in one of the following formats:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":" date-opt-time = date-element ['T' [time-element] [offset]]\n \n Example : 2017-12-29T00:00:00.987\n \n Please note that the time element is optional\n"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":" date-element = std-date-element \n  \n std-date-element  = yyyy ['-' MM ['-' dd]]\n \n Example: 2017-12-29\n"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":" time-element = HH [minute-element] | [fraction]\n \n minute-element = ':' mm [second-element] | [fraction]\n   \n second-element = ':' ss [fraction]\n  \n fraction = ('.' | ',') digit+\n   \n offset = 'Z' | (('+' | '-') HH [':' mm [':' ss [('.' | ',') SSS]]])\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information, refer to ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateOptionalTimeParser--"},"children":["Date format"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"query-nested-arrays-objects","__idx":21},"children":["Query ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," arrays objects ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"nested-queries"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Starting with OSDU's ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://community.opengroup.org/osdu/governance/project-management-committee/-/wikis/M6-Release-Notes"},"children":["M6 release"]},", you can set ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," hints in a data scheme's object array nodes. It leads to accurate indexing of those arrays objects in the underlying search backend."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," attributes can be queried using the Search service in the form of the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested()"]}," function:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["For one level \"nested array\":"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"nested(<path-to-root-nested-array-node>, <root-nested-array-object-fields-query>)\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["For nested (multi-level) \"nested array\" queries:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"nested(<path-to-root-nested-array-node>, nested(<path-to-subrootA-nested-array-node>, <subrootA-nested-array-object-fields-query>))\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Multi-level nested queries are not limited in their depth. You nest them as required by the particular schema."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the examples below, you can see several examples of the root and multi-level nested queries. The syntax of those queries is the same as described in the previous sections. The only distinction is that their conditions are scoped by their own fields of objects of the array, pointed in the first argument of the current ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested(path,(conditions))"]}," function."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"single-level-one-condition-nested-query","__idx":22},"children":["Single-level one condition ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," query"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Where ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["work-product-component--WellboreMarkerSet"]}," has any marker with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MarkerMeasuredDepth"]}," field value greater than 10000:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"kind\" : \"osdu:wks:work-product-component--WellboreMarkerSet:1.0.0\",\n  \"query\": \"nested(data.Markers, (MarkerMeasuredDepth:(>10000)))\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"single-level-several-conditions-nested-query","__idx":23},"children":["Single-level several conditions ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," query"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Where ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["work-product-component--WellboreMarkerSet"]}," has any marker with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["VerticalMeasurement"]}," field value greater than 100 and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["VerticalMeasurementPathID"]}," field value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["osdu-openness:reference-data--VerticalMeasurementPath:ELEV:"]},":"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"kind\": \"osdu:wks:master-data--Wellbore:1.0.0\",\n    \"query\": \"nested(data.VerticalMeasurements, (VerticalMeasurement:(>100) AND VerticalMeasurementPathID:\\\"osdu-openness:reference-data--VerticalMeasurementPath:ELEV:\\\"))\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"combination-of-single-level-nested-queries","__idx":24},"children":["Combination of single-level ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," queries"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Where ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["work-product-component--WellboreMarkerSet"]}," has any marker with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MarkerMeasuredDepth"]}," field value greater ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["10000"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SurfaceDipAzimuth"]}," field value less than ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["360"]},":"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"kind\" : \"osdu:wks:work-product-component--WellboreMarkerSet:1.0.0\", \n  \"query\":\"nested(data.Markers, (MarkerMeasuredDepth:(>10000))) OR nested(data.Markers, (SurfaceDipAzimuth:(<360)))\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"multi-level-nested-queries","__idx":25},"children":["Multi-level ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," queries"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Assume a marker object has a nested ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Revisions"]}," array of Revision objects that have the fields: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RevisionDate"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RevisionEngineer"]},". An indexed document might then look like this:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"  \"data\": {\n      ...\n      \"Markers\": [\n          {\n          ...\n          \"MarkerMeasuredDepth\": 12345.6,\n          \"PositiveVerticalDelta\": 12345.6,\n          \"Revisions\": [\n            \"RevisionDate\": \"2020-02-13T09:13:15.55+0000\",\n            \"RevisionEngineer\": \"John Smith\"\n            ] \n          }\n      ]\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You might want to search for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["work-product-component--WellboreMarkerSet"]}," that has any marker revised on a certain date by a certain engineer:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"kind\" : \"osdu:wks:work-product-component--WellboreMarkerSet:1.0.0\", \n  \"query\":\"nested(data.Markers, nested(data.Markers.Revisions, (RevisionDate:\\\"2020-02-13T09:13:15.55+0000\\\" AND RevisionEngineer:\\\"John Smith\\\")))\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"nested-and-non-nested-queries-parts-combinations","__idx":26},"children":["Nested and non-nested queries parts combinations"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["We can combine both types of queries in one request, such as in the following example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"kind\" : \"osdu:wks:work-product-component--WellboreMarkerSet:1.0.0\",\n  \"query\":\"data.Name:\\\"Example Name\\\" AND nested(data.Markers, (MarkerMeasuredDepth:(>10000)))\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note"]},": Supported boolean operators for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," queries are ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AND"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["OR"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["NOT"]},". These operators are case-sensitives."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"filtering-using-grouping-with-nested-syntax","__idx":27},"children":["Filtering using grouping with nested syntax ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"groupnested"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The nested query parser throws an exception if using a grouping with nested syntax due to the current nested query parser. As a workaround, you can rewrite the query so that it does not involve grouping."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Case 1:"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Instead of:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"kind\":\"*:*:*:*\",\n  \"query\":\"((nested(data.VerticalMeasurements, (VerticalMeasurementID:\\\"KB\\\"))) AND (( kind: \\\"opendes:welldb:wellbore:1.1.3\\\") OR (kind: \\\"opendes:wks:wellbore:1.0.0\\\") OR ( kind: \\\"opendes:welldb:wellbore:1.1.4\\\"))) AND NOT data.DocumentRelationshipType:\\\"child\\\" NOT type:\\\"page\\\"\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"\n{\n    \"kind\": \"*:*:*:*\",\n    \"query\": \"nested(data.VerticalMeasurements, (VerticalMeasurementID:\\\"KB\\\")) AND (kind: \\\"opendes:welldb:wellbore:1.1.3\\\" OR kind: \\\"opendes:wks:wellbore:1.0.0\\\" OR kind: \\\"opendes:welldb:wellbore:1.1.4\\\") NOT data.DocumentRelationshipType:\\\"child\\\" NOT type:\\\"page\\\"\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Case 2:"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Instead of:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"\n{\n  \"kind\":\"*:*:*:*\",\n  \"query\":\"((nested(data.VerticalMeasurements, (VerticalMeasurementID:\\\"KB\\\"))) AND (kind: \\\"opendes:wks:wellbore:1.0.0\\\")) AND NOT data.DocumentRelationshipType:\\\"child\\\" NOT type:\\\"page\\\"\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"\n{\n {\n    \"kind\": \"*:*:*:*\", \n    \"query\": \"nested(data.VerticalMeasurements, (VerticalMeasurementID:\\\"KB\\\")) AND kind: \\\"opendes:wks:wellbore:1.0.0\\\" NOT data.DocumentRelationshipType:\\\"child\\\" NOT type:\\\"page\\\"\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"aggregation","__idx":28},"children":["Aggregation ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"aggregate-queries"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Allows user to get the unique value of a field specified by the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["aggregateBy"]}," request parameter. It supports ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numeric"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["boolean"]}," fields. A maximum of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1000"]}," unique values can be returned by this request."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here is sample query:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": \"osdu:wks:*:*\",\n  \"aggregateBy\": \"kind\"\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"osdu:wks:*:*\",\n  \"aggregateBy\": \"kind\"\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Response:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"results\": [\n    {\n      ....\n    },\n    {\n      ....\n    }\n  ],\n  \"aggregations\": [\n    {\n      \"key\": \"osdu:wks:master-data--Wellbore:1.2.0\",\n      \"count\": 1058850\n    },\n    {\n      \"key\": \"osdu:wks:master-data--Wellbore:1.0.0\",\n      \"count\": 615603\n    },\n    {\n      \"key\": \"osdu:wks:work-product-component--Document:1.0.0\",\n      \"count\": 345894\n    }\n  ],\n  \"totalCount\": 10000\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Please see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#nested-aggregation"},"children":["Aggregation by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," arrays objects"]}," & ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#text-field-aggregation"},"children":["Aggregation on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields"]}," sections for more details on aggregations."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"aggregation-by-nested-arrays-objects","__idx":29},"children":["Aggregation by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," arrays objects ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"nested-aggregation"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," attributes can be aggregated by using the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested(<path-to-root-nested-array-node>, <root-nested-array-object-fields-query>)"]}," function."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"kind\" : \"osdu:wks:work-product-component--WellboreMarkerSet:1.0.0\", \n  \"aggregateBy\": \"nested(data.Markers, MarkerMeasuredDepth)\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"aggregation-on-text-fields","__idx":30},"children":["Aggregation on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"text-field-aggregation"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["As mentioned on ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#text-field-indexing"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field indexing"]}," section, a non-analyzed subfield is added on each ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field (including fields decorated with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," indexing hints on schema) to enable aggregations workflow. This can be utilized to perform aggregation query on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Aggregate by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FacilityName"]},":"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"kind\": \"osdu:wks:*:*\",\n  \"aggregateBy\": \"data.FacilityName.keyword\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Aggregate by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," attribute ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TechnicalAssuranceTypeID"]},":"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"kind\": \"osdu:wks:work-product-component--SeismicTraceData:*\",\n  \"aggregateBy\": \"nested(data.TechnicalAssurances, TechnicalAssuranceTypeID.keyword)\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Fields decorated with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["flattened"]}," indexing hints on schema are by default non-analyzed. They do not require any subfield to enable aggregations."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Aggregate by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["flattened"]}," attribute ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FacilitySpecificationText"]},":"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.0.0\",\n  \"aggregateBy\": \"data.FacilitySpecifications.FacilitySpecificationText\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Caution"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["aggregations"]}," on response may be empty if correct field is not supplied on aggregation query e.g. missing ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["keyword"]}," suffix on a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field inside ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data"]}," block etc."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"sort","__idx":31},"children":["Sort ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"sort-queries"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The sort query allows you to add one or more sorts on specific fields. Each sort can be reversed as well."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The sort feature supports ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["int"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["float"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["double"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["long"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["datetime"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," object, and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," array of objects. Sorting on a geo-point, or a geo-shape type is not supported."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The records either do not have the sorted fields or have empty values that are listed last in the result."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Consider following scenarios:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opendes"]}," data partition has two kinds for welldb data source: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opendes:welldb:wellbore:1.0.0"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opendes:welldb:well:1.0.0"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.Id"]}," in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opendes:welldb:wellbore:1.0.0"]}," has been ingested as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["int"]},", but ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.Id"]}," in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opendes:welldb:well:1.0.0"]}," has been ingested as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opendes:welldb:wellbore:1.0.0"]}," has 10 records in total and 5 of them have an empty value in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.Id"]}," field."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opendes:welldb:well:1.0.0"]}," also has 10 records in total and all of them have values in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.Id"]}," field."]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": \"opendes:welldb:*:*\",\n  \"sort\": {\n    \"field\": [\"data.Id\"],\n    \"order\": [\"ASC\"]\n  }\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"opendes:welldb:*:*\",\n  \"sort\": {\n    \"field\": [\"data.Id\"],\n    \"order\": [\"ASC\"]\n  }\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The above request payload asks the Search service to sort on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.Id"]}," in an ascending order, and the expected response will have \"totalCount: 10\" instead of 20. Note that the 10 returned records are only from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opendes:welldb:wellbore:1.0.0"]}," because the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.Id"]}," in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["opendes:welldb:well:1.0.0"]}," is of data type ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," will not be returned (see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#text-field-sort"},"children":["Sort on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields"]}," for details), and it should list the 5 records which have an empty ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.Id"]}," value at last."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," The Search service does not validate the provided sort field, whether it exists or is of the supported data types. Different kinds may have attributes with the same names, but are different data types. Therefore, it is user's responsibility to be aware and validate this in their own workflow."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The sort query could be very expensive, especially if the given ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," is too broad, such as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["\"kind\": \"*:*:*:*\""]},". The current time-out threshold is 60 seconds. A 504 error, \"Request timed out after waiting for 1m\" will be returned if the request times out. Consider making the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," parameter as narrow as possible while using the sort feature."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"sort-on-text-fields","__idx":32},"children":["Sort on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"text-field-sort"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["As mentioned on ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#text-field-indexing"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field indexing"]}," section, a non-analyzed subfield is added on each ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field to enable sort workflow. This can be utilized to perform sort query on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Sort by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FacilityName"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": \"osdu:wks:*:*\",\n  \"sort\": {\n    \"field\": [\"data.FacilityName.keyword\"],\n    \"order\": [\"ASC\"]\n  }\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"osdu:wks:*:*\",\n  \"sort\": {\n    \"field\": [\"data.FacilityName.keyword\"],\n    \"order\": [\"ASC\"]\n  }\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"sort-on-nested--text-fields","__idx":33},"children":["Sort on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"nested-text-field-sort"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Sorting on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," field decorated with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," indexing hints requires following syntax:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"nested(path, field, mode)\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mode"]}," can have following possible values:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["min"]},": sort by minimum value in the array."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["max"]},": sort by maximum value in the array."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Sort by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," attribute ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FacilityEventTypeID"]}]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.1.0\",\n  \"sort\": {\n    \"field\": [\n          \"nested(data.FacilityEvents, FacilityEventTypeID.keyword, min)\"\n    ],\n    \"order\": [\n        \"ASC\"\n    ]\n  }\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.1.0\",\n  \"sort\": {\n    \"field\": [\n          \"nested(data.FacilityEvents, FacilityEventTypeID.keyword, min)\"\n    ],\n    \"order\": [\n        \"ASC\"\n    ]\n  }\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Please take a look at ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," sort ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://community.opengroup.org/osdu/platform/system/search-service/-/blob/master/docs/tutorial/ArrayOfObjects.md#sort"},"children":["documentation"]}," for more details & examples."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"range-queries","__idx":34},"children":["Range queries ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"range-queries"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Ranges can be specified for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["date"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["numeric"]},", or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," fields. Inclusive ranges are specified with square brackets ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[min TO max]"]}," and exclusive ranges with curly brackets ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{min TO max}"]},". Here are some of the examples:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["All SpudDate in 2012:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"data.SpudDate:[2012-01-01 TO 2012-12-31]\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Count 1..5:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"data.Count:[1 TO 5]\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Count from 10 upwards:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"data.Count:[10 TO *]\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Ranges with one side unbounded can use the following syntax:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"data.ProjDepth:>10\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Combine an upper and lower bound with the simplified syntax, you would need to join two clauses with an AND operator:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"data.ProjDepth:(>=10 AND <20)\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["jobStatus tags between IN_PROGRESS & SUCCESS:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"query\": \"tags.jobStatus:{IN_PROGRESS TO SUCCESS}\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"geo-spatial-queries","__idx":35},"children":["Geo-spatial queries ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"geo-spatial-queries"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Managed Planning Data Foundation supports geo-point (lat/lon pairs) & geo-shape based on ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.rfc-editor.org/rfc/rfc7946"},"children":["GeoJson standard"]},". The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["spatialFilter"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["query"]}," groups in the request have an AND relationship. If both of the criteria are defined in the query, then the Search service will return results which match both clauses."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The queries in this group are ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#geo-distance"},"children":["Geo distance"]},", ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#geo-polygon"},"children":["Geo polygon"]},", and ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#bounding-box"},"children":["Bounding box"]},". Only ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["one"]}," spatial criteria can be used while defining the filter."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note 1:"]}," Geo-spatial fields, which are indexed with GeoJSON FeatureCollection payload, in the Search service query response have a different structure compared to storage records and are optimized for search use-case. These are no valid GeoJSON. To retrieve a valid GeoJSON, use the Storage service's record API."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note 2:"]}," Search backend requires all geo-shape to be ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://geojson.org/"},"children":["GeoJSON"]}," and ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.ogc.org/standard/sfa/"},"children":["OGC"]}," standard complaint. User may see indexing issues if geo-shapes are not complaint. Most common issue violating these standards are geo-shapes with duplicate coordinates or self-intersecting polygon etc. Once users have retrieved record level indexing status or error message via ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#get-indexing-status"},"children":["index status"]},", they are expected to fix the geo-shape and re-try ingestion to address such issues."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"geo-distance-query","__idx":36},"children":["Geo distance query ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"geo-distance"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Filters documents that include only hits that exist ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["within"]}," a specific distance from a geo point."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.0.0\",\n  \"spatialFilter\": {\n    \"field\": \"data.ProjectedBottomHoleLocation.Wgs84Coordinates\",\n    \"byDistance\": {\n      \"point\": {\n        \"latitude\": 37.450727,\n        \"longitude\": -122.174762\n        },\n        \"distance\": 1500\n    }\n  },\n  \"offset\": 0,\n  \"limit\": 30\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.0.0\",\n  \"spatialFilter\": {\n    \"field\": \"data.ProjectedBottomHoleLocation.Wgs84Coordinates\",\n    \"byDistance\": {\n      \"point\": {\n        \"latitude\": 37.450727,\n        \"longitude\": -122.174762\n        },\n        \"distance\": 1500\n    }\n  },\n  \"offset\": 0,\n  \"limit\": 30\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["field"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["geo-point"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["geo-shape"]}," field in the index on which filtering will be performed."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["distance"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The radius of the circle centered on the specified location. Points which falls ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["within"]}," this circle are considered to be matches. The distance can be specified in various units. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#distance-units"},"children":["Distance units"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["point.latitude"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Latitude of field."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["point.longitude"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Longitude of field."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"distance-units","__idx":37},"children":["Distance units ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"distance-units"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If no unit is specified, then the default unit of the distance parameter is meter. Distance can be specified in other units, such as \"1km\" or \"2mi\" (2 miles)."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," In the current version, the Search API only supports distance in meters. In future versions, distance in other units will be made available. The maximum value of distance is 1.5E308."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"bounding-box-query","__idx":38},"children":["Bounding box query ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"bounding-box"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A query allowing you to filter hits based on a point location ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["within"]}," a bounding box."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.0.0\",\n  \"spatialFilter\": {\n    \"field\": \"data.ProjectedBottomHoleLocation.Wgs84Coordinates\",\n    \"byBoundingBox\": {\n      \"topLeft\": {\n        \"latitude\": 37.450727,\n        \"longitude\": -122.174762\n        },\n      \"bottomRight\": {\n        \"latitude\": 37.438485,\n        \"longitude\": -122.156110\n      }\n    }\n  },\n  \"offset\": 0,\n  \"limit\": 30\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.0.0\",\n  \"spatialFilter\": {\n    \"field\": \"data.ProjectedBottomHoleLocation.Wgs84Coordinates\",\n    \"byBoundingBox\": {\n      \"topLeft\": {\n        \"latitude\": 37.450727,\n        \"longitude\": -122.174762\n        },\n      \"bottomRight\": {\n        \"latitude\": 37.438485,\n        \"longitude\": -122.156110\n      }\n    }\n  },\n  \"offset\": 0,\n  \"limit\": 30\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["field"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["geo-point"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["geo-shape"]}," field in the index on which filtering will be performed."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["topLeft.latitude"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The latitude of top left corner of bounding box."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["topLeft.longitude"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The longitude of top left corner of bounding box."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["bottomRight.latitude"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The latitude of bottom right corner of bounding box."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["bottomRight.longitude"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The longitude of bottom right corner of bounding box."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"geo-polygon-query","__idx":39},"children":["Geo polygon query ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"geo-polygon"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A query allowing you to filter hits that only fall ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["within"]}," a closed polygon."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.0.0\",\n  \"spatialFilter\": {\n    \"field\": \"data.ProjectedBottomHoleLocation.Wgs84Coordinates\",\n    \"byGeoPolygon\": {\n      \"points\": [\n        {\"longitude\":-90.65, \"latitude\":28.56},\n        {\"longitude\":-90.65, \"latitude\":35.56},\n        {\"longitude\":-85.65, \"latitude\":35.56},\n        {\"longitude\":-85.65, \"latitude\":28.56},\n        {\"longitude\":-90.65, \"latitude\":28.56} \n      ]\n    }\n  },\n  \"offset\": 0,\n  \"limit\": 30\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.0.0\",\n  \"spatialFilter\": {\n    \"field\": \"data.ProjectedBottomHoleLocation.Wgs84Coordinates\",\n    \"byGeoPolygon\": {\n     \"points\": [\n        {\"longitude\":-90.65, \"latitude\":28.56},\n        {\"longitude\":-90.65, \"latitude\":35.56},\n        {\"longitude\":-85.65, \"latitude\":35.56},\n        {\"longitude\":-85.65, \"latitude\":28.56},\n        {\"longitude\":-90.65, \"latitude\":28.56} \n      ]\n    }\n  },\n  \"offset\": 0,\n  \"limit\": 30\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["field"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["geo-point"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["geo-shape"]}," field in the index on which filtering will be performed."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["points"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The list of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["geo-point"]}," describing polygon."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"geo-polygon-intersection-query","__idx":40},"children":["Geo polygon intersection query ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"geo-polygon-intersection"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A query allowing you to filter hits ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["intersecting"]}," a closed polygon."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.0.0\",\n  \"spatialFilter\": {\n    \"field\": \"data.ProjectedBottomHoleLocation.Wgs84Coordinates\",\n    \"byIntersection\": {\n      \"polygons\": [\n        {\n          \"points\": [\n            {\"longitude\":-90.65, \"latitude\":28.56},\n            {\"longitude\":-90.65, \"latitude\":35.56},\n            {\"longitude\":-85.65, \"latitude\":35.56},\n            {\"longitude\":-85.65, \"latitude\":28.56},\n            {\"longitude\":-90.65, \"latitude\":28.56} \n          ]\n        }\n      ]\n    }\n  },\n  \"offset\": 0,\n  \"limit\": 30\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.0.0\",\n  \"spatialFilter\": {\n    \"field\": \"data.ProjectedBottomHoleLocation.Wgs84Coordinates\",\n    \"byIntersection\": {\n      \"polygons\": [\n        {\n          \"points\": [\n            {\"longitude\":-90.65, \"latitude\":28.56},\n            {\"longitude\":-90.65, \"latitude\":35.56},\n            {\"longitude\":-85.65, \"latitude\":35.56},\n            {\"longitude\":-85.65, \"latitude\":28.56},\n            {\"longitude\":-90.65, \"latitude\":28.56} \n          ]\n        }\n      ]\n    }\n  }\n  },\n  \"offset\": 0,\n  \"limit\": 30\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["field"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["geo-point"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["geo-shape"]}," field in the index on which filtering will be performed."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["points"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["The list of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["geo-point"]}," describing polygon."]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"query-with-cursor","__idx":41},"children":["Query with cursor ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"query-with-cursor"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["While a search request returns a single ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["page"]}," of results, the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["query_with_cursor"]}," API can be used to retrieve large numbers of results, or even all results, from a single search request, in much the same way as you would use a cursor on a traditional database."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Cursor API is not intended for real-time user requests, but rather for processing large amounts of data."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#parameters"},"children":["parameters"]}," passed in the request body are exactly the same as the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["query"]}," API with few exceptions. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["offset"]}," & ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["aggregateBy"]}," are not valid parameters & ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["trackTotalCount"]}," is always ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]}," in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["query_with_cursor"]}," API."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," The results that are returned from a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["query_with_cursor"]}," request reflect the state of the index at the time that the initial search request was made, like a snapshot in time. Subsequent changes to documents (index, update, or delete)  only affect future search requests."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In order to use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["query_with_cursor"]}," request, the initial search request should use the following endpoint:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query_with_cursor HTTP/1.1\n{\n  \"kind\": \"osdu:wks:master-data--Well:1.0.0\",\n  \"query\": \"data.FacilityName:\\\"A34\\\"\",\n  \"limit\": 30,\n  \"spatialFilter\": {\n    \"field\": \"data.SpatialLocation.Wgs84Coordinates\",\n    \"byBoundingBox\": {\n      \"topLeft\": {\n        \"latitude\": 48.450727,\n        \"longitude\": -122.174762\n      },\n      \"bottomRight\": {\n        \"latitude\": 37.450727,\n        \"longitude\": -122.174762\n      }\n    }\n  },\n  \"returnedFields\": [ \"id\", \"data.FacilityName\" ]\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query_with_cursor' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.0.0\",\n  \"query\": \"data.FacilityName:\\\"A34\\\"\",\n  \"limit\": 30,\n  \"spatialFilter\": {\n    \"field\": \"data.SpatialLocation.Wgs84Coordinates\",\n    \"byBoundingBox\": {\n      \"topLeft\": {\n        \"latitude\": 48.450727,\n        \"longitude\": -122.174762\n      },\n      \"bottomRight\": {\n        \"latitude\": 37.450727,\n        \"longitude\": 22.174762\n      }\n    }\n  },\n  \"returnedFields\": [ \"id\", \"data.FacilityName\" ]\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The successful response from the above request will include a \"cursor\", which should be passed to the next call of the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["query_with_cursor"]}," API in order to retrieve the next batch of results."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query_with_cursor HTTP/1.1\n{\n  \"kind\": \"osdu:wks:master-data--Well:1.0.0\",\n  \"cursor\": \"cursor-key\"\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query_with_cursor' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"osdu:wks:master-data--Wellbore:1.0.0\",\n  \"cursor\": \"cursor-key\"\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Caution:"]}," As next batches of results are retrieved by the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["query_with_cursor"]}," API. API users should not expect a different cursor value in each ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["query_with_cursor"]}," response."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," To process the next ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["query_with_cursor"]}," request, the Search service keeps the search context alive for 1 minute, which is the time required to process the next batch of results. Each cursor request sets a new expiry time. The cursor will expire after 1 minute and will not return any more results if the requests are not made within the specified time."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"cross-kind-queries","__idx":42},"children":["Cross ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," queries ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"cross-kind-queries"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Managed Planning Data Foundation search supports cross ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," queries. A typical ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," can be formatted as authority/data-partition-id:data-source-id:entity-type:schema-version. Each text partitioned by ':' can be replaced with wildcard characters to support cross ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," search."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Search across all data-sources, types, and versions for opendes authority:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": \"opendes:*:*:*\"\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"opendes:*:*:*\"\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Search across all data-sources and type wells with schema version 1.0.0:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query_with_cursor HTTP/1.1\n{\n  \"kind\": \"opendes:*:well:1.0.0\"\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"opendes:*:well:1.0.0\"\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Search across all types and versions for the welldb namespace in opendes:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": \"opendes:welldb:*:*\"\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"opendes:welldb:*:*\"\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"common-discovery-within-and-across-kind-via-virtualproperties","__idx":43},"children":["Common discovery within and across ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]}," via ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["VirtualProperties"]}," ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"common-discovery-within-and-across-kind"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A single schema can define multiple properties for geo-spatial data. For example ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Wellbore"]}," schema defines both the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GeographicBottomHoleLocation"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ProjectedBottomHoleLocation"]}," properties. The json key used for spatial data is also not consistent across schemas."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This causes issues for common Search workflows like finding all entities that exist within a given area. This is because users don't know what property to query against for each type so to find all entities in a given area is complicated."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Looking beyond spatial data this is a common problem across different data types, for instance in a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Wellbore"]}," schema the name is represented by the property ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FacilityName"]}," however this key is not used for the name in other schemas."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["OSDU's ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://community.opengroup.org/osdu/data/data-definitions/-/blob/v0.15.0/E-R/ChangeReport.md#snapshot-2021-11-09-towards-m10"},"children":["M10 release"]}," has introduced a new ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x-osdu-virtual-properties"]}," property on Schemas to address common discovery within and across ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["kind"]},". This optional attribute defines a common property mapping. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x-osdu-virtual-properties"]}," can be used to map any properties to a new property name that can be used for consumption. Schemas can then declare the same virtual property to allow easier cross schema consumption. Indexer service indexes new attributes based on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x-osdu-virtual-properties"]}," property declaration."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Here is an example of query on one such property:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": \"*:*:*:*\", \n  \"spatialFilter\": { \n    \"field\": \"data.VirtualProperties.DefaultLocation.Wgs84Coordinates\", \n    \"byGeoPolygon\": { \n      \"points\": [\n         {\"longitude\":-90.65, \"latitude\":28.56}, \n         {\"longitude\":-90.65, \"latitude\":35.56}, \n         {\"longitude\":-85.65, \"latitude\":35.56}, \n         {\"longitude\":-85.65, \"latitude\":28.56}, \n         {\"longitude\":-90.65, \"latitude\":28.56} \n      ]\n    }\n  }\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'content-type: application/json' \\\n  --header 'data-partition-id: opendes' \\\n  --data '{\n  \"kind\": \"*:*:*:*\",\n  \"spatialFilter\": { \n    \"field\": \"data.VirtualProperties.DefaultLocation.Wgs84Coordinates\", \n    \"byGeoPolygon\": { \n      \"points\": [ \n         {\"longitude\":-90.65, \"latitude\":28.56}, \n         {\"longitude\":-90.65, \"latitude\":35.56}, \n         {\"longitude\":-85.65, \"latitude\":35.56}, \n         {\"longitude\":-85.65, \"latitude\":28.56}, \n         {\"longitude\":-90.65, \"latitude\":28.56} \n      ]\n    }\n  }\n}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["More information on supported default VirtualProperties can be found on ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://community.opengroup.org/osdu/data/data-definitions/-/blob/master/E-R/VirtualPropertiesReport.md"},"children":["Data definition's schema documentation"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note:"]}," The virtual property declared is never added to the Storage record and used by Indexer service to index new attribute and make the data discoverable based on this property."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"kinds-excluded-in-wildcard-query-dot-and-system-meta-data-authority","__idx":44},"children":["Kinds excluded in wildcard query: dot and system-meta-data authority"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".slb"]}," as the authority in the WKE Lineage record. This will enable us to get the lineage records excluded from wild card searches while we can still search by using the full kind name."," ","For example, assuming there is a system kind called ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".slb:schema-service:schema:1.0.0"]}," for schema metadata. When users try to search data with keyword wellbore as below:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"{\n  \"kind\": \"*:*:*:*\",\n  \"query\": \"wellbore\"\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The meta-data from the kind ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".slb:schema-service:schema:1.0.0"]}," will be excluded from the search result by default."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In order to search meta-data with keyword wellbore from the kind ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".slb:schema-service:schema:1.0.0"]},", user should explicitly specify the kind as the example below:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"{\n  \"kind\": \".slb:schema-service:schema:1.0.0\",\n  \"query\": \"wellbore\"\n} \n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["NOTE"]},": WE shouldn't use dot prefix as it's internal to Elastic Search. In 7.x, we were allowed to created index with dot, but in 8.x it's deprecated (we're on 8.15). In 9.x you will see errors."," ","Instead ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".slb"]},", use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["system-meta-data"]}," as authority as replacement."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["References to OSDU data-definitions documents:"," ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://community.opengroup.org/osdu/data/data-definitions/-/blob/master/Guides/Chapters/06-LifecycleProperties.md#612-record-kind"},"children":["6.1.2 Record kind"]}," ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://community.opengroup.org/osdu/data/data-definitions/-/blob/master/Guides/Chapters/93-OSDU-Schemas.md#appendix-d13-schema-identifier-kind-limitations"},"children":["Appendix D.1.3 Schema Identifier kind Limitations"]}," ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://community.opengroup.org/osdu/platform/system/search-service/-/blob/master/docs/docs/api.md?ref_type=heads#exclude-kinds-with-authority-as-system-meta-data-in-wildcard-query"},"children":["More details on the exclusion of system-meta-data kinds"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"version-info-api","__idx":45},"children":["Version info API ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"version-info"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Provides build and git related information for Search service."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"GET /api/search/v2/info HTTP/1.1\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request GET \\\n  --url '/search/v2/query' \\\n  --header 'accept: application/json' \\\n  --header 'authorization: Bearer <JWT>' \\\n  --header 'data-partition-id: opendes'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example response:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"groupId\": \"org.opengroup.osdu\",\n  \"artifactId\": \"search-azure\",\n  \"version\": \"0.19.3\",\n  \"buildTime\": \"2023-05-08T18:57:10.854Z\",\n  \"branch\": \"master\",\n  \"commitId\": \"e39447ef448287538a273dc46393b3d9f795c0c1\",\n  \"commitMessage\": \"Merged PR 20150: Use 0.20.0-rc5 of core lib azure\",\n  \"connectedOuterServices\": [\n    {\n      \"name\": \"elasticSearch\",\n      \"version\": \"...\"\n    },\n    {\n      \"name\": \"redis\",\n      \"version\":\"...\"\n    }\n  ]\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This endpoint takes information from files generated by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["spring-boot-maven-plugin"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["git-commit-id-plugin"]}," plugins. Need to specify paths for generated files to matching properties:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["version.info.buildPropertiesPath"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["version.info.gitPropertiesPath"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"get-indexing-status","__idx":46},"children":["Get indexing status ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"get-indexing-status"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Indexer service adds internal metadata to each record which registers the status of the indexing. The metadata includes the status and the last indexing date and time. This additional meta block helps to see the details of indexing. The format of the index meta block is as follows:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"\"index\": {\n    \"trace\": [\n        String,\n        String\n    ],\n    \"statusCode\": Integer,\n    \"lastUpdateTime\": Datetime\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Details of the index block:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["trace"]},": This field collects all the issues related to the indexing and concatenates using '|'. This is a string field."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["statusCode"]},": This field determines the category of the error. This is an integer field. It can have the following values:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["200 - All OK"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["404 - Schema is missing in Schema service."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["400 - Some fields were not properly mapped with the schema defined, such as the schema defined as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["int"]}," for field, but the input record had an attribute value of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["text"]}," etc."]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["lastUpdateTime"]},": This field captures the last time the record was updated by the Indexer service. This is datetime field, so you can do range queries on this field."]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can query the index status using the following example query:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"http","header":{"controls":{"copy":{}}},"source":"POST /search/v2/query HTTP/1.1\n{\n  \"kind\": \"*:*:*:*\",\n  \"query\": \"index.statusCode:404\",\n  \"limit\": 1000,\n  \"returnedFields\": [ \"id\", \"index\" ]\n}\n","lang":"http"},"children":[]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["cURL"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl --request POST \\\n  --url /search/v2/query \\\n  --header 'Authorization: Token' \\\n  --header 'Content-Type: application/json' \\\n  --header 'Data-Partition-Id: opendes' \\\n  --data '{\"kind\": \"*:*:*:*\",\"query\": \"index.statusCode:404\",\"returnedFields\": [\"index\"]}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Example response:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"results\": [\n        {\n            \"index\": {\n                \"trace\": [\n                    \"datetime parsing error: unknown format for attribute: endDate | value: 9000-01-01T00:00:00.0000000\",\n                    \"datetime parsing error: unknown format for attribute: startDate | value: 1990-01-01T00:00:00.0000000\"\n                ],\n                \"statusCode\": 400,\n                \"lastUpdateTime\": \"2018-11-16T01:44:08.687Z\"\n            }\n        }\n    ],\n    \"totalCount\": 31895\n} \n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Note"]},": By default, the API response excludes the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["index"]}," attribute block. You must specify ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["index"]}," field in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["returnedFields"]}," in order to see it in the response."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The above query returns all records which had problems due to fields mismatch."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"known-issueslimitations","__idx":47},"children":["Known issues/limitations ",{"$$mdtype":"Tag","name":"a","attributes":{"name":"known-limitations"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"nested-query","__idx":48},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," query"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," query syntax is sensitive to white spaces, the query below will not work. It does not have a white-space after the property ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["path-to-root-nested-array-node"]}," in this case, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data.VerticalMeasurements"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"kind\": \"osdu:wks:master-data--wellbore:1.0.0\",\n    \"query\": \"nested(data.VerticalMeasurements,(VerticalMeasurement:(>15)))\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The following features are not functional with the current ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," implementation:",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["nested"]}," fields sort query returns erroneous ordering of results."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The current nested query parser throws an exception if using a grouping with nested syntax due to the current nested query parser. As a workaround, you can rewrite the query so that it does not involve grouping. An example can be found ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#groupnested"},"children":["here"]},"."]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"cursor-query","__idx":49},"children":["Cursor query"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["By default, on each data partition only ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["500"]}," concurrent cursor requests can be active. Cursor expires after ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1 minute"]}," timeout or if it's last page of the result. User may see response with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["429"]}," error code and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Too many requests"]}," error message if request load exceeds this limit."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"all-queries","__idx":50},"children":["All queries"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["The maximum size of the response is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["100MB"]},". If the response size exceeds ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["100MB"]},", a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["413"]}," status code response will be returned without any search results."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Currently, tags are indexed out of the box. All input on tags attributes are indexed as a string. Only exact or precise and wildcard queries are supported on these fields."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["When shards in the Elastic Cloud on Kubernetes reaches capacity, one option is to clean up the indices with zero documents or ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/core-service/tutorial/how-to-remove-records-related-to-schema"},"children":["delete the data that is no longer needed"]},", to bring own the shard capacity. The other option is, of course, to increase the shard capacity, which has cost implications."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#TOC"},"children":["Back to table of contents"]}]}]},"headings":[{"value":"Table of contents","id":"table-of-contents","depth":2},{"value":"Introduction","id":"introduction","depth":2},{"value":"Search API access","id":"search-api-access","depth":2},{"value":"Permissions","id":"permissions","depth":2},{"value":"Normalization","id":"normalization","depth":2},{"value":"How conversion is handled for AsIngestedCoordinates and WGS84Coordinates :","id":"how-conversion-is-handled-for-asingestedcoordinates-and-wgs84coordinates-","depth":3},{"value":"Query","id":"query","depth":2},{"value":"Parameters","id":"parameters","depth":3},{"value":"Query by kind","id":"query-by-kind","depth":3},{"value":"Additional kind attributes","id":"additional-kind-attributes","depth":3},{"value":"kind case sensitivity","id":"kind-case-sensitivity","depth":3},{"value":"Text queries","id":"text-queries","depth":3},{"value":"Examples","id":"examples","depth":4},{"value":"text field indexing","id":"text-field-indexing","depth":4},{"value":"Exact match","id":"exact-match","depth":4},{"value":"Query null or empty values","id":"query-null-or-empty-values","depth":4},{"value":"Exists query","id":"exists-query","depth":4},{"value":"Reserved characters","id":"reserved-characters","depth":4},{"value":"Wildcards","id":"wildcards","depth":4},{"value":"Grouping","id":"grouping","depth":3},{"value":"Date Format","id":"date-format","depth":3},{"value":"Query nested arrays objects","id":"query-nested-arrays-objects","depth":2},{"value":"Single-level one condition nested query","id":"single-level-one-condition-nested-query","depth":4},{"value":"Single-level several conditions nested query","id":"single-level-several-conditions-nested-query","depth":4},{"value":"Combination of single-level nested queries","id":"combination-of-single-level-nested-queries","depth":4},{"value":"Multi-level nested queries","id":"multi-level-nested-queries","depth":4},{"value":"Nested and non-nested queries parts combinations","id":"nested-and-non-nested-queries-parts-combinations","depth":4},{"value":"Filtering using grouping with nested syntax","id":"filtering-using-grouping-with-nested-syntax","depth":4},{"value":"Aggregation","id":"aggregation","depth":2},{"value":"Aggregation by nested arrays objects","id":"aggregation-by-nested-arrays-objects","depth":3},{"value":"Aggregation on text fields","id":"aggregation-on-text-fields","depth":3},{"value":"Sort","id":"sort","depth":2},{"value":"Sort on text fields","id":"sort-on-text-fields","depth":3},{"value":"Sort on nested  text fields","id":"sort-on-nested--text-fields","depth":3},{"value":"Range queries","id":"range-queries","depth":2},{"value":"Geo-spatial queries","id":"geo-spatial-queries","depth":2},{"value":"Geo distance query","id":"geo-distance-query","depth":3},{"value":"Distance units","id":"distance-units","depth":3},{"value":"Bounding box query","id":"bounding-box-query","depth":3},{"value":"Geo polygon query","id":"geo-polygon-query","depth":3},{"value":"Geo polygon intersection query","id":"geo-polygon-intersection-query","depth":3},{"value":"Query with cursor","id":"query-with-cursor","depth":2},{"value":"Cross kind queries","id":"cross-kind-queries","depth":2},{"value":"Common discovery within and across kind via VirtualProperties","id":"common-discovery-within-and-across-kind-via-virtualproperties","depth":2},{"value":"Kinds excluded in wildcard query: dot and system-meta-data authority","id":"kinds-excluded-in-wildcard-query-dot-and-system-meta-data-authority","depth":2},{"value":"Version info API","id":"version-info-api","depth":2},{"value":"Get indexing status","id":"get-indexing-status","depth":2},{"value":"Known issues/limitations","id":"known-issueslimitations","depth":2},{"value":"nested query","id":"nested-query","depth":3},{"value":"Cursor query","id":"cursor-query","depth":3},{"value":"All queries","id":"all-queries","depth":3}],"frontmatter":{"seo":{"title":"Table of contents"}},"lastModified":"2025-08-18T21:38:44.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/solutions/core-service/tutorial/search-service","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}