GuillaumeC
GuillaumeC

Reputation: 555

ElasticSearch: Document exists but not found

When I insert new documents into my index, I don't get them... Here is my query:

{ query: 
   { bool: 
      { must: 
         [ { match: { name: 'Here is the name' } },
           { parent_id: { type: 'type', id: 'parentID' } } ] } } }

Just before, I have to add a lot ( around 10 000 documents ), and I can get some documents, and not others, very weird...

Sometimes, I don't the document when I query from the dev tools, it seems to work better after a POST /_refresh, but I still don't have all of them later

Here is how I build my index:

PUT /myIndex
{
   "settings":{
      "index":{
         "number_of_shards":1,
         "refresh_interval" : "-1",
         "number_of_replicas" : 0
      }
   },
   "mappings":{ // MY MAPPING HERE }
}

Thank you very much.

Upvotes: 1

Views: 2827

Answers (1)

Marko Vranjkovic
Marko Vranjkovic

Reputation: 6869

In your settings you have "refresh_interval" : "-1", which means that automatic refreshes are turned off. In this case every time you want to refresh your index (make your documents visible to search), you need to call POST /myIndex/_refresh.

Your refresh_interval value must be > 0 for documents to be automatically refreshed. e.g.

PUT /myIndex/_settings
{ "refresh_interval": "1s" } 

Refresh automatically every second.

Upvotes: 3

Related Questions