2

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 a 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.

Edit 17:29 31/5

So I created a 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 a install out of my life to keep an eye on!

bateman_ap
  • 1,911
  • 7
  • 28
  • 41

2 Answers2

2

I have same problem, but without using access_key. The solution was adding to the client config key transport with value https

fos_elastica:
clients:
    default:
         host: vpc-xxxxxxxxxxxxxxxxxxxxxxxxx.es.amazonaws.com 
         port: 443
         transport: https
Jan Galtowski
  • 878
  • 6
  • 8
0

my problem was in empty aws_access_key_id and aws_secret_access_key values. Please, check it.

Artem
  • 1