Search

InsightMaker.search(query, dataset=None, fields=None, size=100, raw=False)

Parameters:

Response:

A DataSample object, properties:

  • DataSample.df A pandas DataFrame object containing all results

  • DataSample.scroll_id The scroll ID required for a scroll search

Example:

Below is an example of a simple string query, these use Lucene Syntax or more simply, they behave in same way as the search box in the enterprise search app. An asterisk will return all documents.

results = im.search("*", dataset = "sharepoint")
print(results.df)

Alternatively, a python dictionary can be used to store an Elastic Query DSL JSON query. This is the most complex, but also most flexible way to query InsightMaker. For example:

query = {
    "bool": {
        "must":
            [
                {
                    "range": {"size": {"gte": 1000, "lt": 2000}}
                },
                {
                    "bool":
                        {
                            "must_not": [{"regexp": {"name": {"value": ".*\\.txt"}}}]
                        }
                }
            ]
    }
}

results = im.search(query, dataset = "documents", size = 10)
print(results.df)