elastic / elasticsearch-specification

Elasticsearch full specification
Apache License 2.0
111 stars 67 forks source link

Add semantic_text and semantic query #2622

Closed carlosdelest closed 3 weeks ago

carlosdelest commented 3 weeks ago

Add support for the upcoming semantic_text and semantic query.

l-trotta commented 3 weeks ago

@carlosdelest from the server code it seems like there are some other parameters for the Semantic Text property. Are all of those internal? Like model_settings for example

carlosdelest commented 3 weeks ago

hey @l-trotta ! Good catch - model_settings is used internally and should not be set by the user, but internally from the mapping itself when a document is added.

I believe these are the properties exposed by the field type.

l-trotta commented 3 weeks ago

Thanks for the clarification, just making sure :D What about copy_to? From the documentation it looks like it's accepted, but then the server code says otherwise. Tested this in the devtools:

PUT my-index-000003
{
  "mappings": {
    "properties": {
      "inference_field": {
        "type": "semantic_text",
        "inference_id": "my-elser-endpoint",
        "copy_to": "field"
        }
    }
  }
}

returns:

{
  "error": {
    "root_cause": [
      {
        "type": "mapper_parsing_exception",
        "reason": "Failed to parse mapping: semantic_text field [inference_field] does not support [copy_to]"
      }
    ],
    "type": "mapper_parsing_exception",
    "reason": "Failed to parse mapping: semantic_text field [inference_field] does not support [copy_to]",
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "semantic_text field [inference_field] does not support [copy_to]"
    }
  },
  "status": 400
}
carlosdelest commented 3 weeks ago

My bad @l-trotta ! semantic_text can be the target of copy_to, but not have copy_to fields itself. Thanks for the catch, fixed it!