Elasticsearch | Very slow search


I am benchmarking search speed using different parameters.
One specific parameter used is copy_to implementation.

Scenario 1.

  1. Number of Fields : 10000
  2. Documents indexed : 500
  3. Indices : 10
  4. Search on Indices : 10 at once
    Search Speed using copy_to field: 20ms -3s

Scenario 2.

  1. Number of Fields : 10000
  2. Documents indexed : 100000
  3. Indices : 10
  4. Search on Indices : 10 at once
    Search Speed using copy_to field: 6s - 18s

I suppose the number of documents stored in Elasticsearch will not affect the search speed.
Also, since the use of copy_to field, it will reduce the number of disk seeks during search to one field. Hence even this should not be something to worry about
Why is there a drastic increase in search speed when number of documents increased?
Am I missing something here? Because this is driving me crazy!

What kind of searches are you running?

Multiple should clauses

  1. Phrase match
  2. Phrase with slop
  3. Word based Fuzziness
  4. Word based match

Are you running these against the copy_to field you mentioned? Can you show some examples?

yes, I am running these against copy_to.
The query contains

  1. "query_string_query" for exact phrase match,
  2. "multi_match" for phrase with slop
  3. "multi_match" for word with fuzziness
  4. "multi_match" for word based match

@Christian_Dahlqvist any suggestions?

Can you show some full example queries and how long they take to run? Why do you have so many fields in your index?

Thanks Christian for quick response.
Like I mentioned earlier, this is a benchmarking process.
My query is something of this sort

	"query": {
          "bool": {
            "should": [
             1. Query String query of exact match
             2. Multi_match of type phrase with slop of 1
             3.  Multi_match with fuzziness 
             4. Multi_match without fuzziness 
            "minimum_should_match": 1

That does not look like a valid query. Can you please show a full example?

These four are the clauses of bool should query.

I give up. As you are not answering my questions I will leave this for someone else.

1 Like

As @Christian_Dahlqvist asked, you need to give a real and complete example. Not pseudo-code. Otherwise, there is no way to help you I'm afraid.

If you are using query string queries without specifying a field name, be aware that the old _all field has been replaced by an all_fields mode, which can be slow if you have a lot of fields it need to iterate over. Combine this with slop and fuzziness and you could have a very expensive (and slow) query. You may also want to look into creating a custom copy_all field to use by default, much like the old _all field worked.

Thanks for your suggestion. I am using copy_to field.

Then please provide detailed information, mappings and actual queries. Without that it is impossible to help.

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