Number of characters in field
Hi. I am trying to find a way to express a character count filter in a querystring, for instance: I need to find all documents with field subject that holds less than 20 chars. How would i do that in a querystring ? /David -- You received this message because you are subscribed to the Google Groups elasticsearch group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4163e674-b9ec-4be1-b142-c5636521f573%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Number of characters in field
You could use a script filter: filtered : { query : { ... }, filter : { script : { script : doc['subject'].value.length() 20 } } } Dan On Thursday, May 22, 2014 8:45:41 AM UTC+1, David Nielsen wrote: Hi. I am trying to find a way to express a character count filter in a querystring, for instance: I need to find all documents with field subject that holds less than 20 chars. How would i do that in a querystring ? /David -- You received this message because you are subscribed to the Google Groups elasticsearch group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9d7cff9d-1449-4635-b780-89ce6102ec77%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Number of characters in field
Well yes i know that one, is this really the only/best way to do it?. My application is forwarding an input field directly to a querystring, the user need to be able to query something like this: tags:h1 AND subject:lenght20 On Thursday, May 22, 2014 2:30:30 PM UTC+2, Dan Tuffery wrote: You could use a script filter: filtered : { query : { ... }, filter : { script : { script : doc['subject'].value.length() 20 } } } Dan On Thursday, May 22, 2014 8:45:41 AM UTC+1, David Nielsen wrote: Hi. I am trying to find a way to express a character count filter in a querystring, for instance: I need to find all documents with field subject that holds less than 20 chars. How would i do that in a querystring ? /David -- You received this message because you are subscribed to the Google Groups elasticsearch group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/2d4f588a-4655-4286-9e12-4d4b4d0015e6%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.