kolchfa-aws f5b8ff79fd
Add score normalization and combination documentation (#4985)
* Add search phase results processor

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add hybrid query

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Normalization processor additions

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add more details

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Continue writing

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add more query then fetch details and diagram

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Small rewording

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Leaner left nav headers

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Tech review feedback

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add semantic search tutorial

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Reworded prerequisites

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Removed comma

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Rewording advanced prerequisites

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Changed searching for ML model to shorter request

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Update task type in register model response

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Changing example

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Added huggingface prefix to model names

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Change example responses

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Added note about huggingface prefix

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Update _ml-commons-plugin/semantic-search.md

Co-authored-by: Naarcha-AWS <97990722+Naarcha-AWS@users.noreply.github.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

* Implemented doc review comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* List weights under parameters

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Remove one-shard warning for normalization processor

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Apply suggestions from code review

Co-authored-by: Nathan Bower <nbower@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>

* Implemented editorial comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Change links

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* More editorial feedback

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Change model-serving framework to ML framework

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Use get model API to check model status

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Implemented tech review comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Added neural search description and diagram

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* More editorial comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Add link to profile API

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Addressed more tech review comments

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

* Implemented editorial comments on changes

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>

---------

Signed-off-by: Fanit Kolchina <kolchfa@amazon.com>
Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com>
Co-authored-by: Naarcha-AWS <97990722+Naarcha-AWS@users.noreply.github.com>
Co-authored-by: Nathan Bower <nbower@amazon.com>
2023-09-22 17:29:58 -04:00

4.5 KiB

layout title nav_order has_children parent grand_parent
default Rename field 20 false Search processors Search pipelines

Rename field processor

The rename_field search response processor intercepts a search response and renames the specified field. This is useful when your index and your application use different names for the same field. For example, if you rename a field in your index, the rename_field processor can change the new name to the old one before sending the response to your application.

Request fields

The following table lists all available request fields.

Field Data type Description
field String The field to rename. Required.
target_field String The new field name. Required.
tag String The processor's identifier.
description String A description of the processor.
ignore_failure Boolean If true, OpenSearch ignores a failure of this processor and continues to run the remaining processors in the search pipeline. Optional. Default is false.

Example

The following example demonstrates using a search pipeline with a rename_field processor.

Setup

Create an index named my_index and index a document with the field message:

POST /my_index/_doc/1
{
  "message": "This is a public message", 
  "visibility":"public"
}

{% include copy-curl.html %}

Creating a search pipeline

The following request creates a search pipeline with a rename_field response processor that renames the field message to notification:

PUT /_search/pipeline/my_pipeline
{
  "response_processors": [
    {
      "rename_field": {
        "field": "message",
        "target_field": "notification"
      }
    }
  ]
}

{% include copy-curl.html %}

Using a search pipeline

Search for documents in my_index without a search pipeline:

GET /my_index/_search

{% include copy-curl.html %}

The response contains the field message:

Response {: .text-delta} ```json { "took" : 1, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 2, "relation" : "eq" }, "max_score" : 1.0, "hits" : [ { "_index" : "my_index", "_id" : "1", "_score" : 1.0, "_source" : { "message" : "This is a public message", "visibility" : "public" } } ] } } ```

To search with a pipeline, specify the pipeline name in the search_pipeline query parameter:

GET /my_index/_search?search_pipeline=my_pipeline

{% include copy-curl.html %}

The message field has been renamed to notification:

Response {: .text-delta} ```json { "took" : 2, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 1, "relation" : "eq" }, "max_score" : 0.0, "hits" : [ { "_index" : "my_index", "_id" : "1", "_score" : 0.0, "_source" : { "visibility" : "public", "notification" : "This is a public message" } } ] } } ```

You can also use the fields option to search for specific fields in a document:

POST /my_index/_search?pretty&search_pipeline=my_pipeline
{
    "fields":["visibility", "message"]
}

{% include copy-curl.html %}

In the response, the field message has been renamed to notification:

Response {: .text-delta} ```json { "took" : 4, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 1, "relation" : "eq" }, "max_score" : 0.0, "hits" : [ { "_index" : "my_index", "_id" : "1", "_score" : 0.0, "_source" : { "visibility" : "public", "notification" : "This is a public message" }, "fields" : { "visibility" : [ "public" ], "notification" : [ "This is a public message" ] } } ] } }
</details>