Aşağıdaki örnek komutları elasticsearch indexiniz için kullanabilirisiniz.

Mapping


Bu mapping bilgisi bir symfony uygulamasına ait ve FOSElasticaBundle paketini için ayarlanmıştır.


fos_elastica:
clients:
default: { host: 127.0.0.1, port: 9203 }
indexes:
post_index:
client: default
index_name: post_dev
types:
post:
mappings:
id:
type: string
index: not_analyzed
title:
type: string
analyzer: english
fields:
raw:
type: string
index: not_analyzed
description:
type: string
analyzer: english
fields:
raw:
type: string
index: not_analyzed
year:
type: integer
index: not_analyzed
price:
type: double
index: not_analyzed
is_published:
type: boolean
index: not_analyzed
created_at:
type: date
index: not_analyzed
persistence:
driver: mongodb
model: Application\MongoBundle\Document\Post
finder: ~
provider: ~
listener: ~

Komutlar


# Check currently running ES server details
$ curl -X GET http://127.0.0.1:9203

# Show index mapping information
$ curl -X GET 127.0.0.1:9203/post_dev?pretty
$ curl -X GET 127.0.0.1:9203/_mapping/post?pretty

# Run an ES query in terminal
$ curl -s -XGET 127.0.0.1:9203/post_dev/_search -d '{json query goes here}'

# Get some sample data from ES index
$ curl -XGET 127.0.0.1:9203/post_dev/_search?pretty=1

# Delete index
$ curl -XDELETE 'http://127.0.0.1:9203/post_dev'

# Create an index
$ curl -XPUT 'localhost:9200/my_new_index?pretty'

# List all indexes in ES server
$ curl 127.0.0.1:9200/_cat/indices?v