PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, October 24, 2022

[FIXED] Why index is not creating in elasticsearch 8.3.2 automatically

 October 24, 2022     elasticsearch, python     No comments   

Issue

  • i m using Python api to insert and fetch from elasticsearch, verseion is 8.3.2

  • data = [ { 'id': 1, 'Title': 'Live1'},{ 'id': 2, 'Title': 'Live2'},{ 'id': 3, 'Title': 'Live3'}]

  • when try inserting I got Not Found error, It was working in version 7

from elasticsearch import Elasticsearch
client = Elasticsearch("http://user:password@localhost:9200")

for e in data:
    client.index(index="movie_data", document=e, id=e['id'])

Error > NotFoundError: NotFoundError(404, 'index_not_found_exception', "no such index [movie_data] and [action.auto_create_index] ([.monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*]) doesn't match")

In my yaml file i have added this action.auto_create_index: .monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*

  • My related question is when i tried client.indices.get_mapping( 'movie_data' )

I got error > TypeError: Positional arguments can't be used with Elasticsearch API methods. Instead only use keyword arguments.


Solution

In your action.auto_create_index list you don't have movie_data so the index cannot be auto-created.

You can either add it or remove that line completely.



Answered By - Val
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing