That is unfortunately not possible. Elasticsearch doesn't store the original order of these elements when indexing it, so you can't query for first (or any order) of element. If you are often requiring that query, you could either store the first element in a separate field, you you know, that you will need to query it often. You could also prefix all values by their path id, like 1_something, 2_otherlink2, etc. so that you can query for them (maybe also as a copy of this field).
Also if you have the original path as one keyword available you could use a wildcard query on it, to check if it starts with a specific path.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.