1

I try to create an index template for my heterogeneous data. Is there a way to ingest Documents with a field that is sometimes a list of lists:

{
  "xx_response_body": [
    [
      123123,
      ...
    ],
    [
      12312344,
      ...
    ],
    
    ....
  ],
  "Content-Type": "application/json",
  "Vary": "Cookie",
  "x-xss-protection": "1; mode=block"
}

and sometimes an object:

{
  "xx_response_body": {
    "abc": "error",
    "def": "content",
    "hij": {}
  },
  "Content-Type": "application/json",
  "x-xss-protection": "1; mode=block"
}
``
1
  • 1
    Not possible, a field in an index can have only one type. If your field can be a string or array of string in some documents and a json object in other documents, you will need to choose one type and rename the field with the other type during the ingestion process. Commented Dec 30, 2021 at 13:37

1 Answer 1

1

You're better off by creating different fields for these types of fields or storing your data in separate indices, your future self will thank you.

There's also flattened data type that might work, but I've not used that in the past.

Another alternative approach would be storing this information as a string and using runtime fields to extract these fields if you wanted to, but that will always be slower than actually indexing them.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.