Skip to content

Instantly share code, notes, and snippets.

@shofetim
Created July 3, 2017 22:17
Show Gist options
  • Save shofetim/e0120422db515781b6c5d5acd1e9c677 to your computer and use it in GitHub Desktop.
Save shofetim/e0120422db515781b6c5d5acd1e9c677 to your computer and use it in GitHub Desktop.

My mappings:

{
  "abstract": {
    "type": "text",
    "term_vector": "with_positions_offsets"
  },
  "app_country": {
    "type": "text",
    "term_vector": "with_positions_offsets"
  },
  "app_date": {
    "type": "date",
    "format": "year_month_day"
  },
  "app_doc_num": {
    "type": "text",
    "term_vector": "with_positions_offsets"
  },
  "applicants": {
    "type": "nested",
    "properties": {
      "city": {
        "type": "text",
        "term_vector": "with_positions_offsets"
      },
      "country": {
        "type": "text",
        "term_vector": "with_positions_offsets"
      },
      "first_name": {
        "type": "text",
        "term_vector": "with_positions_offsets"
      },
      "kind": {
        "type": "text",
        "term_vector": "with_positions_offsets"
      },
      "last_name": {
        "type": "text",
        "term_vector": "with_positions_offsets"
      },
      "organization": {
        "type": "text",
        "term_vector": "with_positions_offsets"
      },
      "state": {
        "type": "text",
        "term_vector": "with_positions_offsets"
      }
    }
  },
  "assignees": {
    "type": "nested",
    "properties": {
      "organization": {
        "type": "text",
        "term_vector": "with_positions_offsets"
      },
      "role": {
        "type": "text",
        "term_vector": "with_positions_offsets"
      }
    }
  },
  "claims": {
    "type": "text",
    "term_vector": "with_positions_offsets"
  },
  "class_type": {
    "type": "text",
    "term_vector": "with_positions_offsets"
  },
  "description": {
    "type": "text",
    "term_vector": "with_positions_offsets"
  },
  "invention_title": {
    "type": "text",
    "term_vector": "with_positions_offsets"
  },
  "pub_date": {
    "type": "date",
    "format": "year_month_day"
  },
  "pub_doc_num": {
    "type": "text",
    "term_vector": "with_positions_offsets"
  },
  "pub_kind": {
    "type": "text"
  }
}

And the query:

curl -XGET 'localhost:9200/patents_v7/_search' -H 'Content-Type: application/json' -d'
{
  "from": 0,
  "size": 25,
  "sort": [
    {
      "_score": {
        "order": "desc"
      }
    }
  ],
  "highlight": {
    "pre_tags": [
      "<b>"
    ],
    "post_tags": [
      "</b>"
    ],
    "order": "score",
    "number_of_fragments": 3,
    "require_field_match": false,
    "type": "fvh",
    "boundary_scanner": "sentence",
    "fields": {
      "*": {}
    }
  },
  "query": {
    "query_string": {
      "query": "Elastomer"
    }
  },
  "stored_fields": [
    "*"
  ],
  "docvalue_fields": [
    "pub_date",
    "app_date"
  ]
}'

And the error:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "[highlight] unknown field [boundary_scanner], parser not found"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "[highlight] unknown field [boundary_scanner], parser not found"
  },
  "status": 400
}
@shofetim
Copy link
Author

shofetim commented Jul 3, 2017

"version": {
    "number": "5.1.1",
    "build_hash": "5395e21",
    "build_date": "2016-12-15T22:47:19.049Z",
    "build_snapshot": false,
    "lucene_version": "6.3.0"
  }

@shofetim
Copy link
Author

shofetim commented Jul 3, 2017

Solved, the boundary_scanner options is not supported until ES 5.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment