Response Metadata and Attributes
The LawInsider API uses ElasticSearch on the backend, one of the most widely used databases to store text documents. The front-end uses the proprietary syntax described on these pages. Consequently, the documents the search returns includes ElasticSearch attributes. Some of these will be quite useful for you to fine-tine and debug your searches. Below we give some examples.
Snippet
This shows which part of your query matched the document. It's called snippet because it's design to show just a part of the longer document, so it won't be too long.
That matching text is also shown in the group-id
and name
.
"_index": "clause",
"_type": "_doc",
"_id": "en/exhibit-list",
"_score": 78.28703,
"_source": {
"snippet": "The exhibits attached to this lease are listed below. All exhibits are a part of this lease except for those which have been lined out or which have been shown below as omitted. Exhibit A Floor Plan of Lessee's Office Space (paragraph 1.1) Exhibit B Legal Description of Office Building (paragraph 1.1) Exhibit C Building Operating Expense Passthrough Calculations (paragraphs 2.1 and 32.1) Exhibit D Acknowledgment of Lease (paragraph 4.2) Exhibit E Construction by Lessor (paragraph 5.1) Exhibit F-1 Parking Rules (paragraphs 9.2 and 23.1) Exhibit F-2 Building Rules (paragraph 23.1) Exhibit G Estoppel Certificate (paragraph 30.1) Exhibit H Lease Guaranty (paragraph 37.1) Exhibit I Corporate Resolution Authorizing Lease or Guaranty (paragraphs 37.1 and 39.1) Exhibit J Special Conditions (paragraph 37.2) Exhibit K Hazardous Materials Statement Exhibit L Acknowledgment of Receipt of Agency Disclosure",
"group_id": "exhibit-list",
"name": "EXHIBIT LIST"
}
Score
The score is a numerical value assigned to each document that indicates how well it matches the search criteria specified in the query.
Score is shown at the top of the search results (inside the hits
attribute and in each document found inside the hits
array).
"hits": {
"total": {
"value": 10000,
"relation": "gte"
},
"max_score": 29.37838,
"hits": [{
"_index": "contract",
"_type": "_doc",
"_id": "en/3Bu2DzjPb9i",
"_score": 29.37838,
aggregations
These give you counts by index for all documents in the database. It will be the same for all searches as it's just information about the whole database.
"aggregations": {
"_index": {
"doc_count": 13640796,
"_index": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [{
"key": "clause",
"doc_count": 7642134
}, {
"key": "definition",
"doc_count": 3829213
}, {
"key": "contract",
"doc_count": 1992511
}, {
"key": "company",
"doc_count": 93448
}, {
"key": "category",
"doc_count": 82933
}, {
"key": "jurisdiction",
"doc_count": 386
}, {
"key": "country",
"doc_count": 171
}]
}
}
}
Source
This shows you the text that matched the search. It shows a snippet
, meaning only a portion of the document, as the entire document would be too long. It also gives information on matching words.
"_source": {
"snippet": "means Exhibit 1 to this Schedule C.",
"group_id": "exhibit-1",
"name": "Exhibit 1"
},
"matched_queries": ["EXHIBIT"]
Suggest
Suggestions (also known as autocomplete or did-you-mean suggestions) are a feature that helps users find relevant search terms even if they've made a typo, misspelling, or used a slightly different term.
For example, if we write this query:
{
"query": {
"q": "+THIS +ESCROW +AGREEMENT +PART +(South Carolina | North Carolina)"
}
}
Law Insider suggests that we might try again with tis and escrub based upon how frequently this and escrow have been misspelled in this document database.
"suggest": {
"suggestions": [
{
"text": "this",
"offset": 1,
"length": 4,
"options": [
{
"text": "tis",
"score": 0.6666666,
"freq": 1
}
]
},
{
"text": "escrow",
"offset": 7,
"length": 6,
"options": [
{
"text": "escrub",
"score": 0.6666666,
"freq": 1
}
]
},
Hits and Inner Hits
This section shows snippets that match the clause and definition queries that you defined. How to do that is explained here.
"inner_hits": {
"definition:Business Day": {
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 8.161037,
"hits": [
{
"_index": "contract",
"_type": "_doc",
"_id": "en/3QS3HcUIP2o",
"_nested": {
"field": "sections",
"offset": 325
},
"_score": 8.161037,
"_source": {
"snippet": "shall mean any day other than a Saturday, Sunday or a day on which all banking institutions in New York, New York are authorized or obligated by Law or executive order to close.",
"name": "Business Day",
"type": "definition",
"value": "business-day"
Highlight
The highlight is designed to highlight matching documents, meaning put HTML boldface around matching terms. The reason for that is so that if you were to use this HTML in your application it would be formatted with rich text. In this example, the matching term is "matched_queries": ["employee"]
"highlight": {
"body": ["<b>Employee</b> further acknowledges that if <b>Employee</b> is a new <b>employee</b>, <b>Employee</b> has had advance notice of", "<b>Employee</b> further agrees not to contact any such <b>employee</b> of the Company or to cause the <b>employee</b> to be", "For a current <b>employee</b>, <b>Employee</b> acknowledges that <b>Employee</b> has received a copy of this Agreement at", "further acknowledges that if <b>Employee</b> is a new <b>employee</b>, <b>Employee</b> had advance notice (at least two (", "<b>Employee</b> further agrees that if, at the time <b>Employee</b> signs this Agreement, <b>Employee</b> does not earn at"]
}
"matched_queries": ["employee"]
Updated about 1 year ago