简体   繁体   English

在Watson Discovery Service中查询缺少/未定义字段的文档

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

We have a set of JSON documents loaded into Watson Discovery Service. 我们将一组JSON文档加载到Watson Discovery Service中。 Some have a field (say X) for example X: MyXValue and some don't have that field at all. 有些具有一个字段(例如X),例如X:MyXValue,而有些根本没有该字段。 Can I write a query in WDS language that will return all documents in the collection that are missing the X field? 我可以用WDS语言编写查询,该查询将返回集合中所有缺少X字段的文档吗? Thanks, Eldad 谢谢,Eldad

Not sure about your question but I think that you can try to use the query and the filter parameter. 不确定您的问题,但我认为您可以尝试使用queryfilter参数。

filter 过滤

An unranked query language search for matching documents. 未排序的查询语言搜索匹配的文档。

Example: filter=bees 示例: filter=bees

You can also check my link above to try another parameters that can be really useful for your queries with WDS. 您也可以在上方查看我的链接,尝试使用其他参数,这些参数对于使用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 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. 您可能会认为可以对通配符( X:!* )使用“不包括”运算符,但是不会返回任何结果。

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. 如果可能的话,应该在文档中添加一个属性,以便可以测试存在的属性,而不是尝试检测是否缺少属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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