0 votes
1 view
in AWS by (18.2k points)

I am trying to get FOSElasticaBundle working on AWS ElasticSearch. At the moment I have my development env all set up and working perfectly using Docker containers for ElasticSearch using

FROM docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.4

If I populate my ElasticSearch using:

docker-compose exec php php /var/www/symfony/bin/console fos:elastica:populate --env=prod

this all works perfectly and the index has searchable items in it.

However, moving this to AWS is throwing up an issue.

I have set up an ElasticSearch service (v6.2) within AWS using their VPN option, I am able to connect to this (I know it does connect as I had connection errors until I used this in the config:

fos_elastica:

  clients:

    default:

        transport: 'AwsAuthV4'

        aws_access_key_id: '%amazon.s3.key%'

        aws_secret_access_key: '%amazon.s3.secret%'

        aws_region: '%amazon.s3.region%'

When I run

php bin/console fos:elastica:populate --env=prod it looks like it is populating

3200/6865 [=============>--------------]  46% 4 secs/9 secs

Populating ppc/keywords

Refreshing ppc

But once complete my Amazon console shows 0 searchableDocuments and if run a query I get nothing back.

Has anyone come across this and any idea how to solve it, even being able to get more feedback from populate would help me work out where it is going wrong?

So I created an Elasticsearch install in a docker container on a standard EC2 instance and pointed at that and it indexes perfectly, so it is something to do with the connection with AWS. One of the differences between them is that the Docker install doesn't have to use:

transport: 'AwsAuthV4'

aws_access_key_id: '%amazon.s3.key%'

aws_secret_access_key: '%amazon.s3.secret%'

aws_region: '%amazon.s3.region%'

I presume then it's something to do with this, I would have thought if it wasn't authorised though I would get an error. Although it's working currently I would prefer to use the Amazon service just so it takes an install out of my life to keep an eye on!

1 Answer

0 votes
by (42.5k points)

Check with the empty values for aws_access_key_id and aws_secret_access_key values. 

Also, it worked when adding it to the client config key transport with https:

fos_elastica:

clients:

    default:

         host: vpc-xxxxxxxxx.es.amazonaws.com 

         port: 443

transport: https

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...