質問

I am parsing Elasticsearch explain output. I am trying to find out how deep can be be the first relevant description as part of value, description, details combination. I am trying to parse descriptions that have either "weight" or "CustomScore".

As I could not find a Json parser that has XPath like functionality for finding sibling nodes (say I found a description node because matched on string "weight(" then I want to collect the "value" which is sibling node) I am relying on recursion. I have seen a description with "weight" or "CustomScore" to be at 5 levels deep, from the first value, description, details combination. this is ok by me. I was wondering if it ever goes deeper to higher magnitudes say 10, 20 or 30.

役に立ちましたか?

解決

The explain output depends on the query that is getting executed. If you look carefully at its structure you will notice that it matches the elements of the query and inner elements of the explanation correspond to the inner structures of the query. So, the relevant to you elements can be as deep as your query will ask them to be. Please also note that explain feature was never meant to be used in production. It's quite heavy weight and slow. I am not quite sure what problem you are trying to solve by parsing the explanation, but I suspect there might be a more efficient solution than explanation parsing.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top