Has something changed with GraphQL between version...
# troubleshoot
s
Has something changed with GraphQL between versions v0.9.6 and v0.10.0? I have queries that ran under the old version but not the new. The Changelog suggests there have been changes in the GraphQL system but not ones I'd expect to break queries. I used to be able to do a query like this with a variable like {"query_string": "customProperties: file_hash=046ca7acf03915c611818e20837c2e4b8756e885"} where file_hash is a customProperty which I can see in the GUI.
Copy code
query my_query($query_string:String!){
  search(input: { type: DATASET, query: $query_string, start: 0, count: 100 }) {
                start
                count
                total
                searchResults {
                entity {
                    urn
                    type
                    ...on Dataset {
                        name
                        properties {customProperties {key
                        value
                        }}
                    }
                }
                }
            }
}
e
Hi @strong-kite-83354 that’s really strange
What are the logs that you’re getting back?
a
There’s a legacy feature for fullText search that should be part of
searchCriteria,
we can look and see if it’s maybe not being exposed properly
maybe this is a syntax issue?
b
Could you try this variation? At least for a temporary workaround?
Copy code
{
  "query_string": "\"file_hash=046ca7acf03915c611818e20837c2e4b8756e885\""
}
s
Hi @echoing-airport-49548 - I was getting a successful search return but with an empty list of results - so the query ran successfully. Thanks - @brainy-tent-14503 - that fixed my test.
Hi @astonishing-answer-96712 - I'm not very comfortable working in GraphQL - I spent quite a while getting anything to work (by random mutation of my queries)! My queries are probably not very tasteful but they were touched by my test suite so it was fairly obvious something had changed. I notice the DataHub code base queries from Python using JSON rather than any intermediate library. I wondered if you have links to useful resources on GraphQL - the examples on the DataHub homepage are more focussed on retrieval than search.
b
There are 3 different APIs at the moment, these include Restli, OpenAPI, and GraphQL. Because DataHub originated based on the Restli framework, those APIs are generally the more foundational. OpenAPI exists with some generic APIs however lacks search support. Therefore Restli and GraphQL support search to varying degrees. What you’ve found here is a miss in the GraphQL interface, the type of query you were using is using an advanced syntax for Elasticsearch and was moved behind a parameter which was only added to the Restli API and which will be extended to GraphQL. That said I think I would probably prefer the GraphQL API today for search. There is not a lot of detail other than the basic input/output shape. I often find that inspecting the graphql queries that the UI makes helps me to find examples of applying various filters and options. What you may find interesting is the underlying documentation for the Elasticsearch query, by default the search box and your graphql query string is using this simple syntax. Your original query used to rely on this variation which is more advanced but often leads to errors when searching. We are going to allow both versions in the graphql api going forward.