Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ScriptProcessor fails with char data type #14382

Open
andrross opened this issue Jun 15, 2024 · 4 comments
Open

[BUG] ScriptProcessor fails with char data type #14382

andrross opened this issue Jun 15, 2024 · 4 comments
Labels
bug Something isn't working Indexing Indexing, Bulk Indexing and anything related to indexing

Comments

@andrross
Copy link
Member

Describe the bug

The following ingest pipeline will fail when indexing a document:

{
  "description": "_description",
  "processors": [
    {
      "script" : {
        "source" : "ctx.char = (char)'a'"
      }
    },
    {
      "script" : {
        "source" : "ctx.other_field = 'other_field'"
      }
    }
  ]
}

Issue #14379 is a very similar symptom for other data types, but the cause appears to be different. I have a fix ready to go for #14379 but this issue appears to be related to XContent serialization and it wasn't immediately obvious to me how to fix it, so I've created a separate issue. Also the other issue was a regression introduced in OpenSearch 2.8, whereas this issue appears to have existed prior to OpenSearch 2.8.

Related component

Indexing

To Reproduce

Index a document with the pipeline defined above.

Expected behavior

Success

Additional Details

  1> Caused by: java.lang.IllegalArgumentException: cannot write xcontent for unknown value of type class java.lang.Character
  1>    at org.opensearch.core.xcontent.XContentBuilder.unknownValue(XContentBuilder.java:866)
  1>    at org.opensearch.core.xcontent.XContentBuilder.map(XContentBuilder.java:928)
  1>    at org.opensearch.core.xcontent.XContentBuilder.map(XContentBuilder.java:903)
  1>    at org.opensearch.action.index.IndexRequest.source(IndexRequest.java:384)
  1>    at org.opensearch.ingest.IngestService.updateIndexRequestWithIngestDocument(IngestService.java:1314)
  1>    at org.opensearch.ingest.IngestService.lambda$innerExecute$11(IngestService.java:1044)
  1>    at org.opensearch.ingest.IngestDocument.lambda$executePipeline$0(IngestDocument.java:814)
  1>    at org.opensearch.ingest.Pipeline.lambda$execute$0(Pipeline.java:140)
  1>    at org.opensearch.ingest.CompoundProcessor.innerExecute(CompoundProcessor.java:260)
  1>    at org.opensearch.ingest.CompoundProcessor.lambda$innerExecute$4(CompoundProcessor.java:287)
  1>    at org.opensearch.ingest.Processor.execute(Processor.java:77)
  1>    at org.opensearch.ingest.CompoundProcessor.innerExecute(CompoundProcessor.java:269)
  1>    at org.opensearch.ingest.CompoundProcessor.lambda$innerExecute$4(CompoundProcessor.java:287)
  1>    at org.opensearch.ingest.Processor.execute(Processor.java:77)
  1>    at org.opensearch.ingest.CompoundProcessor.innerExecute(CompoundProcessor.java:269)
  1>    at org.opensearch.ingest.CompoundProcessor.execute(CompoundProcessor.java:153)
  1>    at org.opensearch.ingest.Pipeline.execute(Pipeline.java:134)
  1>    at org.opensearch.ingest.IngestDocument.executePipeline(IngestDocument.java:807)
  1>    at org.opensearch.ingest.IngestService.innerExecute(IngestService.java:1034)
  1>    at org.opensearch.ingest.IngestService.executePipelines(IngestService.java:881)
  1>    ... 6 more
@andrross andrross added bug Something isn't working untriaged labels Jun 15, 2024
@github-actions github-actions bot added the Indexing Indexing, Bulk Indexing and anything related to indexing label Jun 15, 2024
@peternied
Copy link
Member

[Triage - attendees 1 2 3 4 5]
@andrross Thanks for creating this issue

@vikasvb90
Copy link
Contributor

@andrross Can we close this now as PR for the fix has been merged?

@andrross
Copy link
Member Author

andrross commented Jul 8, 2024

@vikasvb90 #14379 has been fixed, but has this one been fixed yet?

@vikasvb90
Copy link
Contributor

Ah ok! No, char issue is still pending. Please keep it open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Indexing Indexing, Bulk Indexing and anything related to indexing
Projects
None yet
Development

No branches or pull requests

4 participants