Apply text analysis on a field

I have a field of type text let's call it my_field . This field contains comma separated values, sometimes these values can repeat many times for example : 'sun' or 'sun,cloud' or 'sun,sun,sun,cloud' or 'sun,cloud,wind,sun,wind,sun' etc.. what I am willing to do is to enable the users to search for documents where this field for example has the word sun three times or has the word cloud only one time and so on. Is there a way to do this with text analysis in elasticsearch, scripted fields, regexp query with{}...etc?

I want to do this search using Kibana search bar and I am using Elasticsearch/Kibana v6.3.2

You could basically use a wildcard query if I understood correctly

But how can I search for all documents where my_field value has 3 x for example

This should do the job:

"query": {
"wildcard" : { "my_field" : { "value" : "xxx", "boost" : 2.0 } }

Sorry it's : * x * x * x * in the query

Thanks but this does not answer my question, I want something general, I want to enable the user to use Kibana search bar to search for documents with let's say my_field's value contains 6 x's (x is just an example it might be a word) RegE query has {} expression but it does not seems to be working as I have followed the example here but it did not work for me :frowning: .

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.