forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into test/ensure-vectors-searchable-bwc-test
- Loading branch information
Showing
18 changed files
with
339 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 109651 | ||
summary: Support synthetic source for `geo_point` when `ignore_malformed` is used | ||
area: Mapping | ||
type: enhancement | ||
issues: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
libs/x-content/src/main/java/org/elasticsearch/xcontent/CopyingXContentParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
package org.elasticsearch.xcontent; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* A parser that copies data that was parsed into a {@link XContentBuilder}. | ||
* This parser naturally has some memory and runtime overhead to perform said copying. | ||
* Use with {@link XContentSubParser} to preserve the entire object. | ||
*/ | ||
public class CopyingXContentParser extends FilterXContentParserWrapper { | ||
private final XContentBuilder builder; | ||
|
||
public CopyingXContentParser(XContentParser delegate) throws IOException { | ||
super(delegate); | ||
this.builder = XContentBuilder.builder(delegate.contentType().xContent()); | ||
switch (delegate.currentToken()) { | ||
case START_OBJECT -> builder.startObject(); | ||
case START_ARRAY -> builder.startArray(); | ||
default -> throw new IllegalArgumentException( | ||
"can only copy parsers pointed to START_OBJECT or START_ARRAY but found: " + delegate.currentToken() | ||
); | ||
} | ||
} | ||
|
||
@Override | ||
public Token nextToken() throws IOException { | ||
XContentParser.Token next = delegate().nextToken(); | ||
builder.copyCurrentEvent(delegate()); | ||
return next; | ||
} | ||
|
||
public XContentBuilder getBuilder() { | ||
return builder; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.