〜113000のドキュメントのインデックスがあります。私はそれらすべてを取得しようとしていますが、スコアは気にしません。基本的に select * from index;
そして、私はelasticutilsを使用してPythonでこれを行っています(まだelasticsearch-dslに切り替える時間が見つかりません)
ランニング
S().indexes('da_userstats').query().count()
約 0.003 秒で完了します。
ランニング
S().indexes('da_userstats').query()[0:113595].execute().objects
約15秒かかります。
ドキュメントについて私が理解していることから、両方とも実行を強制する必要があるため、時間に大きな違いがある理由がわかりません。
マッピングで、フィールドを分析しないようにマークしようとしましたが、効果はありませんでした。なぜこんなに桁違いの違いがあるのか 本当にわかりません。
@classmethod
def get_mapping(cls):
return {
'properties': {
'id': {
'type': 'integer',
'index': 'not_analyzed',
"include_in_all": False,
},
'email': {
'type': 'string',
'index': 'not_analyzed',
"include_in_all": False
},
'username': {
'type': 'string',
'index': 'not_analyzed',
"include_in_all": False
},
'date_joined': {
'type': 'string',
'index': 'not_analyzed',
"include_in_all": False
},
'last_activity': {
'type': 'string',
'index': 'not_analyzed',
"include_in_all": False
},
'last_activity_web': {
'type': 'string',
'index': 'not_analyzed',
"include_in_all": False
},
'last_activity_ios': {
'type': 'string',
'index': 'not_analyzed',
"include_in_all": False
},