Hello. I use elasticsearch v8.17.2. I need to do simple search by very big index 40M+ docs. But i works unexpected. My index have default analyzer without tokenization. So I can use only "phrase_prefix" for search by start of word.
Indices configuration:
mapping
/_mapping
{
"prod_index": {
"mappings": {
"properties": {
"aggs": {
"type": "object"
},
"count": {
"type": "integer"
},
"from": {
"type": "long"
},
"hash": {
"type": "long"
},
"name": {
"type": "text"
},
"query": {
"properties": {
"bool": {
"properties": {
"should": {
"properties": {
"match_all": {
"type": "object"
}
}
}
}
}
}
},
"size": {
"type": "long"
},
"sort": {
"properties": {
"_id": {
"properties": {
"order": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
},
"version": {
"type": "boolean"
}
}
}
}
}
index settings
index settings
/_settings
{
"people_positions": {
"settings": {
"index": {
"routing": {
"allocation": {
"include": {
"_tier_preference": "data_content"
}
}
},
"number_of_shards": "1",
"provided_name": "people_positions",
"creation_date": "1747217800469",
"number_of_replicas": "0",
"uuid": "xfKYGzvRTVG9RHvIwD41tg",
"version": {
"created": "8521000"
}
}
}
}
}
I debug this problem I create little text index with 1k+ docs. This simple example is worked.
Request small test index
/test_index/_search
{
"query": {
"bool": {
"must": [
{
"match_phrase_prefix": {
"name": {
"query": "man"
}
}
},
{
"range": {
"count": {
"gte": 100
}
}
}
]
}
}
}
Response small test index
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 1,
"relation": "eq"
},
"max_score": 3.6122494,
"hits": [
{
"_index": "test_index",
"_id": "1000",
"_score": 3.6122494,
"_source": {
"count": 11000,
"name": "IT manager",
"hash": null
}
}
]
}
}
But on big production index with 40M+ docs I have no result:
[/details]
Request big index
prod_index/_search
{
"query": {
"bool": {
"must": [
{
"match_phrase_prefix": {
"name": {
"query": "man"
}
}
},
{
"range": {
"count": {
"gte": 100
}
}
}
]
}
}
}
Response big index
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 0,
"relation": "eq"
},
"max_score": null,
"hits": []
}
}
I have this document which I expect see:
prod_index/_doc/{ID}
Get document response
{
"_index": "prod_index",
"_id": "id",
"_version": 434184,
"_seq_no": 43418186,
"_primary_term": 3,
"found": true,
"_source": {
"count": 434184,
"name": "IT manager",
"hash": null
}
}