简体   繁体   中英

Querying for documents that have missing / undefined fields in Watson Discovery Service

We have a set of JSON documents loaded into Watson Discovery Service. Some have a field (say X) for example X: MyXValue and some don't have that field at all. Can I write a query in WDS language that will return all documents in the collection that are missing the X field? Thanks, Eldad

Not sure about your question but I think that you can try to use the query and the filter parameter.

filter

An unranked query language search for matching documents.

Example: filter=bees

You can also check my link above to try another parameters that can be really useful for your queries with WDS.

No, you can't write that query. The query operators are documented at

https://console.bluemix.net/docs/services/discovery/query-operators.html#query-operators

You might think that you could use the "does not include" operator with a wildcard ( X:!* ), but that doesn't return any results.

If possible you should add an attribute to your documents so that you can test an attribute that is present, rather than trying to detect the absence of an attribute.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM