Skip to content

Commit

Permalink
[Entity Store] Bugfix: Double nested arrays (elastic#197589)
Browse files Browse the repository at this point in the history
## Summary

Entities were appearing in the entity store with double nested arrays
like below.

The issue was that the arrays changed from `List` to `Set` type and the
code only checked for lists. Using `Collection` has fixed this.

```
        "_index": ".entities.v1.latest.security_host_default",
        "_id": "c03w7AZsMkm_obWF2HZEirgAAAAAAAAA",
        "_score": 1,
        "_source": {
          "host": {
            "hostname": [
              [
                "small-host-1.example.small.com"
              ]
            ],
            "domain": [
              [
                "example.small.com"
              ]
            ],
            "ip": [
              [
                "192.168.1.1",
                "192.168.1.0",
                "192.168.1.3",
                "192.168.1.2",
                "192.168.1.9",
                "192.168.1.8",
                "192.168.1.5",
                "192.168.1.4",
                "192.168.1.7",
                "192.168.1.6"
              ]
            ],
            ```

---------

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
hop-dev and elasticmachine authored Oct 24, 2024
1 parent 9f35065 commit 855456b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class EntityStoreDataClient {
filter,
pipelineDebugMode
).catch((error) => {
logger.error('There was an error during async setup of the Entity Store', error);
logger.error(`There was an error during async setup of the Entity Store: ${error}`);
});

return descriptor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const collectValuesProcessor: FieldRetentionOperatorBuilder<CollectValues
Set uniqueVals = new HashSet();
if (!(${isFieldMissingOrEmpty(ctxField)})) {
if(${ctxField} instanceof List) {
if(${ctxField} instanceof Collection) {
uniqueVals.addAll(${ctxField});
} else {
uniqueVals.add(${ctxField});
Expand Down

0 comments on commit 855456b

Please sign in to comment.