2

I am planning to maintain search history of users by indexing each search text as a document in elastic search. I thought of using a Prefix query to get list of Suggestions for the users. along with the prefix query i have used an Multimatch query to get the terms that match in the middle of the text as well.

the pseudo query looks like below :

{
"query" : {
    bool : {
          should : {
                    "Prefix query"{
                      }
                     "multimatch query"{
                     }
            } 
    }
}

}

Before that I would like to know how good is it use Prefix Query for sugestions.

I am maintaining an Index for each day and would like to query the history of last 30 days.

will it be an performance issue ? want to clear this before I start implementing it.and are there any alternative's for prefix query in this kind of a scenario.

I have already implemented suggestions with Completion suggester but my requirement is to provide user with suggestions based on history and with a support of matching the terms in the middle of the text as well.

ravinder reddy
  • 309
  • 1
  • 4
  • 17

2 Answers2

1

In my previous project we used the query language, which heavily rely on operators like this star|part-of-term|star, and I could say in some bad curcimstances (big index - 100+ mln docs, big text to analyze, complex terms, multiple languages) - Lucene could behave slowly (basically, because leading stars are heavy in standard Lucene implementation, also, they are prohibited). All it was implemented without MultiMatchQuery.

One could imagine, that implementing improvements like suffix arrays (https://en.wikipedia.org/wiki/Suffix_array) will help (at least it helped us)

So, conclusion, be careful, and if your index (since it's only 30 days of history) is relatively small you should be fine.

Mysterion
  • 9,050
  • 3
  • 30
  • 52
0

Usually Elasticsearch does a good job in search. It could be slower in complex nested aggregation queries but simple search is very fast. I don't think you need to worry too much in advance.

pkhlop
  • 1,824
  • 3
  • 18
  • 23