Hi,
I am framing a query on attribute named distinguished name(dn)
Example: "dn" : "cn=abc,ou=def,o=ig".
i am looking for query where dn ends with o=ig and has only one child for example "dn": "cn=abc,o=ig"
"dn": "cn=hgg,o=ig"
"dn": "ou=abc,o=ig" and etc.
i tried this below query, can anyone figure out whats wrong in there.
Yes, you should be using dn.keyword. The reason it doesn't work is because your regular expression is incorrect. Elasticsearch/Lucene uses a slightly different syntax from what you may be used to. Check the documentation.
What's incorrect:
the anchors ^ and $ are not supported. The regular expression must match the entire string.
You forgot the + after the [a-zA-Z0-9] to match multiple characters
You forgot some characters in the expression as there could also be a = or , in there
Basically i am trying to simulate "scope" = one flag in ldapsearch.
so for example say base is o=ig and scope = one that means only its immediate child will be returned.
thats why i am trying this , "dn" : "cn=A-REPAIR,o=ig"
where o=ig is base and if scope is one only its immediate child will be returned.
that means in this case dn will have only one comma and end with o=ig
Both regular expressions work fine for me, with the exception that the - needs to be escaped as it is a special character. Please check the documentation for the regular expression syntax
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.