Retrieve multiple values from one field name


#1

I have following data in elastic search

  1. Index: test-1.2018
  2. Field Name: "test"
  3. Field value : "Test" , Test1", "Hello", "Fellow", "And other values" and so forth ...

How can I retrieve all the field values of a field type named "test" ? What query should I run ? I read questions on this forum as well as docs. But it is not clicking for some reason. Any help will be appreciated.

curl -XGET localhost:9201/test-1.*/_search -H 'Content-Type: application/json' -d '{
"query": {
"match": {
"test": "some kind of wildcard - may be "
}
}
}

Is there a way to get all the values of "test" field ? Please feel free to point me to right docs and will check it out.


(David Pilato) #2

Not all but the main ones may be...

You can do that with a terms aggregation I believe.


#3

I am using 6.1 v of es and aggregation should work as you mentioned. But i wasn't getting the results that I wanted. I guess I should try again and see if I go anywhere. Thanks.


(David Pilato) #4

If you don't succeed and need help, please provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.