Why does SearchScript call multiple times?

my source code:

public Function<Map<String, Object>, SearchScript> compile(
    		String scriptName, String scriptSource, Map<String, String> params) {
    	checkScriptSource(scriptSource);
    	logger.info("start compline script name: {}, source: {}", scriptName, scriptSource);
    	return p -> new SearchScriptBuilder()
    			.params(p)
    			.restHighLevelClient(restHighLevelClient)
    			.queryVectoryResearcherFactory(queryVectoryResearcherFactory)
    			.build();
    }
public class SearchScriptBuilder implements BaseBuilder<SearchScript> {
@Override
	public SearchScript build() {
		logger.info("build search script, thread name: {}", Thread.currentThread().getName());
		validateParams();
		return newProduct();
	}
}

my logs:

[2017-11-24T10:43:22,589][INFO ][com_tvd12                ] start compline script name: double_array_similarity, source: double_array_similarity
[2017-11-24T10:43:22,592][INFO ][com_tvd12                ] build search script, thread name: elasticsearch[8iFnvKh][search][T#2]
[2017-11-24T10:43:22,592][INFO ][com_tvd12                ] build search script, thread name: elasticsearch[8iFnvKh][search][T#4]
[2017-11-24T10:43:22,593][INFO ][com_tvd12                ] build search script, thread name: elasticsearch[8iFnvKh][search][T#3]
[2017-11-24T10:43:22,594][INFO ][com_tvd12                ] build search script, thread name: elasticsearch[8iFnvKh][search][T#5]
[2017-11-24T10:43:22,600][INFO ][com_tvd12                ] build search script, thread name: elasticsearch[8iFnvKh][search][T#1]

May be because you have more than one shard?

Yes, by default, I have 5 primary shards and 1 replica

So that's why.

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