**Problem is :** I am forming ES queries using elasticsearch_dsl Q(). It works perfectly fine in most of the cases when my query contains any complex regexp. But it totally fails if it contains regexp character `'!'` in it. It doesn't give any result when the search term contains `'!'` in it.
ok, can you tell, In my mapping my types are set as 'keyword'? is that the only thing required to read the search term as it is? if yes, then why its dropping '!' character? also i can i make use of analyze() function to see what's happening exactly? Also, I tried doing this:
I am unable to follow the docs to make use of analyze api? I am executing my query like below:
search_obj = Search(using = _conn, index = _index, doc_type = _type).query(Q('regexp', field1 = "f04baz?")) count = search_obj.count() response = search_obj[0:count].execute() logger.debug("total nodes(hits):" + " " + str(response.hits.total)) Can you tell how do i put analyze code here to check how it's getting tokenized plz?
i just tried to do something like this` ^(f04ba)[^z]+?$` instead of this` f04((?!z).)*` to avoid answers with z; and it did work. Does this thing gives you any hint that why `!` in the regexp query doesnt give any results?
The `~` (tilde) is the *complement* that is *used to negate an atom right after it. An atom is either a single symbol or a group of subpatterns/alternatives inside a group.
NEW: Monitor These Apps!
Apache Lucene, Apache Solr and all other Apache Software Foundation project and their respective logos are trademarks of the Apache Software Foundation.
Elasticsearch, Kibana, Logstash, and Beats are trademarks of Elasticsearch BV, registered in the U.S. and in other countries. This site and Sematext Group is in no way affiliated with Elasticsearch BV.
Service operated by Sematext